Expand description
Task monitoring and execution module.
This module provides the core functionality for managing and executing tasks with dependency relationships. It includes configuration types, error handling, event monitoring, and execution strategies.
§Core Components
tasks::TaskMonitor
: Main struct for managing task executionconfig::TaskSpec
: Task configuration with dependencies and execution optionsconfig::TaskShell
: Cross-platform shell configurationevent::TaskMonitorEvent
: Event types for monitoring task executionerror::TaskMonitorError
: Error types for task monitoring operationsexecutor
: Task execution strategies (currently direct execution)
§Usage
The typical workflow involves:
- Create task specifications with dependencies
- Build a
TaskMonitor
with the task collection - Execute tasks either directly or with event monitoring
use std::collections::HashMap;
use tcrm_monitor::monitor::{tasks::TaskMonitor, config::{TaskSpec, TaskShell}};
use tcrm_task::tasks::config::TaskConfig;
let mut tasks = HashMap::new();
tasks.insert(
"compile".to_string(),
TaskSpec::new(TaskConfig::new("cargo").args(["build"]))
.shell(TaskShell::Auto)
);
let mut monitor = TaskMonitor::new(tasks)?;
monitor.execute_all_direct(None).await;
Re-exports§
pub use tasks::TaskMonitor;