pub struct TaskExecutor { /* private fields */ }Expand description
Task executor responsible for running tasks
Implementations§
Source§impl TaskExecutor
impl TaskExecutor
pub fn new(config: ExecutorConfig) -> Self
Sourcepub async fn execute_task(
&self,
task: Arc<Task>,
scheduled_time: SystemTime,
) -> Result<String, SchedulerError>
pub async fn execute_task( &self, task: Arc<Task>, scheduled_time: SystemTime, ) -> Result<String, SchedulerError>
Execute a task asynchronously
Sourcepub async fn cancel_task(
&self,
execution_id: &str,
) -> Result<(), SchedulerError>
pub async fn cancel_task( &self, execution_id: &str, ) -> Result<(), SchedulerError>
Cancel a running task
Sourcepub async fn get_execution(&self, execution_id: &str) -> Option<TaskExecution>
pub async fn get_execution(&self, execution_id: &str) -> Option<TaskExecution>
Get task execution status
Sourcepub async fn get_task_executions(&self, task_id: &str) -> Vec<TaskExecution>
pub async fn get_task_executions(&self, task_id: &str) -> Vec<TaskExecution>
Get all executions for a task
Sourcepub async fn get_metrics(&self) -> ExecutionMetrics
pub async fn get_metrics(&self) -> ExecutionMetrics
Get current metrics
Sourcepub async fn running_task_count(&self) -> usize
pub async fn running_task_count(&self) -> usize
Get number of running tasks
Sourcepub async fn cleanup_old_executions(&self, older_than: Duration)
pub async fn cleanup_old_executions(&self, older_than: Duration)
Clean up completed executions older than the specified duration
pub async fn execute_task_with_delay( &self, task: Arc<Task>, scheduled_time: SystemTime, execution_delay: Option<Duration>, ) -> Result<String, SchedulerError>
Auto Trait Implementations§
impl Freeze for TaskExecutor
impl !RefUnwindSafe for TaskExecutor
impl Send for TaskExecutor
impl Sync for TaskExecutor
impl Unpin for TaskExecutor
impl UnsafeUnpin for TaskExecutor
impl !UnwindSafe for TaskExecutor
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