pub struct TaskScheduler { /* private fields */ }
Expand description
任务调度器
Implementations§
Source§impl TaskScheduler
impl TaskScheduler
Sourcepub fn new(config: ParallelConfig) -> Self
pub fn new(config: ParallelConfig) -> Self
创建新的任务调度器
Sourcepub fn add_task(&self, lazy_expr: Arc<LazyExpression>) -> usize
pub fn add_task(&self, lazy_expr: Arc<LazyExpression>) -> usize
添加任务
Sourcepub fn get_next_task(&self) -> Option<ComputeTask>
pub fn get_next_task(&self) -> Option<ComputeTask>
获取下一个可执行的任务
Sourcepub fn complete_task(
&self,
task_id: usize,
result: Result<Expression, ComputeError>,
)
pub fn complete_task( &self, task_id: usize, result: Result<Expression, ComputeError>, )
标记任务完成
Sourcepub fn get_task_result(
&self,
task_id: usize,
) -> Option<Result<Expression, ComputeError>>
pub fn get_task_result( &self, task_id: usize, ) -> Option<Result<Expression, ComputeError>>
获取任务结果
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
获取待执行任务数量
Sourcepub fn running_count(&self) -> usize
pub fn running_count(&self) -> usize
获取正在执行任务数量
Sourcepub fn completed_count(&self) -> usize
pub fn completed_count(&self) -> usize
获取已完成任务数量
Sourcepub fn cleanup_completed(&self)
pub fn cleanup_completed(&self)
清理已完成的任务
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TaskScheduler
impl RefUnwindSafe for TaskScheduler
impl Send for TaskScheduler
impl Sync for TaskScheduler
impl Unpin for TaskScheduler
impl UnwindSafe for TaskScheduler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more