pub struct TaskScheduler { /* private fields */ }Expand description
Task scheduler
Implementations§
Source§impl TaskScheduler
impl TaskScheduler
Sourcepub fn submit_task(&mut self, task: Task) -> Result<(), AmbientError>
pub fn submit_task(&mut self, task: Task) -> Result<(), AmbientError>
Submit task
Sourcepub fn get_pending_tasks(&self) -> Vec<Task>
pub fn get_pending_tasks(&self) -> Vec<Task>
Get pending tasks
pub fn get_pending_tasks_into( &self, out: &mut [TaskHandle], ) -> Result<usize, AmbientError>
Sourcepub fn dispatch_next(&mut self) -> Option<Task>
pub fn dispatch_next(&mut self) -> Option<Task>
Dispatch the next pending task to a device, moving it to running.
Returns the dispatched task, or None if no tasks are pending.
Sourcepub fn complete_task(
&mut self,
task_id: &str,
device_id: &str,
success: bool,
usage: ResourceUsage,
)
pub fn complete_task( &mut self, task_id: &str, device_id: &str, success: bool, usage: ResourceUsage, )
Mark a running task as completed, recording it in execution history.
Sourcepub fn running_count(&self) -> usize
pub fn running_count(&self) -> usize
Get the number of currently running tasks.
Sourcepub fn completed_count(&self) -> usize
pub fn completed_count(&self) -> usize
Get the number of completed tasks.
Sourcepub fn recent_history(&self, n: usize) -> &[TaskExecutionRecord]
pub fn recent_history(&self, n: usize) -> &[TaskExecutionRecord]
Get recent execution history records.
Sourcepub fn set_policy(&mut self, policy: SchedulingPolicy)
pub fn set_policy(&mut self, policy: SchedulingPolicy)
Set the scheduling policy.
Auto Trait Implementations§
impl Freeze for TaskScheduler
impl RefUnwindSafe for TaskScheduler
impl Send for TaskScheduler
impl Sync for TaskScheduler
impl Unpin for TaskScheduler
impl UnsafeUnpin for TaskScheduler
impl UnwindSafe for TaskScheduler
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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