pub async fn run_graph<F, S, O>(
ctx: &RunContext<'_, F, S, O>,
created_at_unix: u64,
) -> Result<RunGraphOutcome, RunGraphError>Expand description
Run every task in the validated graph subject to the
workspace’s concurrency caps and the mutex compatibility
rules of EXEC-006 condition 3 + EXEC-007.
The loop:
- Resolves the workspace’s
concurrency.defaultto a concrete cap and pre-computes the per-task tag set. - On each admission round, walks
state.readyin canonical order and admits every task whose caps (EXEC-004,EXEC-005) permit. Admission consults caps ONLY; the mutex check is deferred perEXEC-007step 1 (“no mutex hold is taken during cache lookup”). Each admitted task firesRunObserver::on_task_startedonce (tracked viastarted) and pushes a lookup-step future. - The lookup-step future runs
cache_lookup_phase. On hit, it drivesrestore_from_hitinline (no mutex interaction, perMUTEX-007) and reports the outcome. On miss, it stops short and reports the data the scheduler needs for the post-lookup mutex check. - On a miss completion the scheduler evaluates the live
mutex hold set. When compatible, it acquires the
mutex per
MUTEX-006and pushes a spawn-step future (run_fresh). When incompatible (perMUTEX-005/EXEC-007step 3 incompatible branch), the slot is released, the task returns toready, and the next admission round re-evaluates. - On a spawn-step completion the scheduler releases the
held mutex, releases the slot, fires
RunObserver::on_task_finished, records the outcome, and either promotes hard successors to ready (succeeded) or cascade-skips hard descendants (failed, perEXEC-010). - Terminates when no futures are in flight; tasks marked
skip never enter
ready, so the loop’s emptiness condition is well-defined for any graph including diamonds, fan-ins, and disconnected subgraphs.
§Errors
This revision never returns Err: a single task’s failure
does not abort the run (per EXEC-010), and the only paths
that could yield a top-level error in the current scope are
covered by per-task RunTaskErrors captured in
RunGraphOutcome::task_errors. Future revisions will grow
RunGraphError with scheduler-level diagnostics (runtime
cycle detection, runtime output overlap).
§Panics
Panics if ctx.graph references a task whose project or
task name is absent from ctx.workspace. A validated graph
is built from the workspace’s effective task set; a node
referring to a non-existent task would be a builder bug.