1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! Scheduler module for kaish — pipelines, background jobs, and scatter/gather.
//!
//! This module provides:
//! - **Pipeline execution**: Run commands connected by pipes, where stdout
//! of one command flows to stdin of the next.
//! - **Background jobs**: Run commands in the background with `&`, track them,
//! and wait for completion.
//! - **Scatter/Gather**: Parallel fan-out and collection for pipelines.
//!
//! # Architecture
//!
//! ```text
//! ┌─────────────────────────────────────────────────────────────┐
//! │ PipelineRunner │
//! │ ┌─────────┐ channel ┌─────────┐ channel ┌────────┐│
//! │ │ cmd1 │────────────▶│ cmd2 │────────────▶│ cmd3 ││
//! │ │ (spawn) │ stdout │ (spawn) │ stdout │ (spawn)││
//! │ └─────────┘ └─────────┘ └────────┘│
//! └─────────────────────────────────────────────────────────────┘
//!
//! ┌─────────────────────────────────────────────────────────────┐
//! │ ScatterGatherRunner │
//! │ ┌────────────┐ ┌─────────────────────────┐ │
//! │ │ pre_scatter│────────▶│ scatter (fan-out) │ │
//! │ └────────────┘ │ ┌───┐ ┌───┐ ┌───┐ │ │
//! │ │ │ 1 │ │ 2 │ │ 3 │ ... │ │
//! │ │ └───┘ └───┘ └───┘ │ │
//! │ │ │ │ │
//! │ │ ▼ │ │
//! │ │ gather (collect) │ │
//! │ └─────────────────────────┘ │
//! │ │ │
//! │ ▼ │
//! │ ┌────────────┐ │
//! │ │ post_gather│ │
//! │ └────────────┘ │
//! └─────────────────────────────────────────────────────────────┘
//!
//! ┌─────────────────────────────────────────────────────────────┐
//! │ JobManager │
//! │ jobs: HashMap<JobId, Job> │
//! │ - spawn(pipeline) → JobId │
//! │ - wait(JobId) → ExecResult │
//! │ - wait_all() → Vec<ExecResult> │
//! │ - list() → Vec<JobInfo> │
//! └─────────────────────────────────────────────────────────────┘
//! ```
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;