smelter_job_manager/
lib.rs1#![warn(missing_docs)]
2#![warn(clippy::missing_docs_in_private_items)]
3
4use std::{borrow::Cow, fmt::Debug};
7
8use error_stack::Report;
9use serde::de::DeserializeOwned;
10pub use smelter_worker::SubtaskId;
11pub use spawn::{SpawnedTask, TaskError};
12
13mod job;
14mod manager;
15mod run_subtask;
16mod scheduler;
17mod spawn;
18mod stage;
19mod task_status;
20#[cfg(test)]
21mod test_util;
22
23pub use job::*;
24pub use manager::*;
25pub use scheduler::*;
26pub use spawn::*;
27pub use stage::*;
28pub use task_status::*;
29
30#[derive(Debug)]
32pub struct TaskDefWithOutput<DEF: SubTask> {
33 pub task_def: DEF,
35 pub output: DEF::Output,
37 pub stats: Option<smelter_worker::stats::Statistics>,
39}
40
41#[async_trait::async_trait]
43pub trait SubTask: Clone + Debug + Send + Sync + 'static {
44 type Output: Debug + DeserializeOwned + Send + 'static;
46
47 fn description(&self) -> Cow<'static, str>;
49
50 async fn spawn(
52 &self,
53 task_id: SubtaskId,
54 logs: Option<LogSender>,
55 ) -> Result<Box<dyn SpawnedTask>, Report<TaskError>>;
56}