Skip to main content

aggregate_terminal_status

Function aggregate_terminal_status 

Source
pub fn aggregate_terminal_status<I>(statuses: I) -> Option<Status>
where I: IntoIterator<Item = Status>,
Expand description

Aggregate a set of node statuses into the run’s rolled-up terminal status, or None when the run is not yet complete.

The single, shared roll-up rule — used both by the supervisor’s per-tick rollup_status and by cancel_node’s in-lock self-roll-up (so the two can never diverge). A three-way classification (design §2.5, “rollup terminalizes the run cancelled/done/failed once every node is terminal”):

  • None if the set is empty (a freshly-created run must not vacuously complete) or if ANY node is still live (Pending/Running/Blocked);
  • Some(Status::Failed) if any node genuinely Failed (a real failure dominates the batch outcome);
  • Some(Status::Cancelled) if no node failed but at least one was Cancelled (a deliberate per-node/whole-run cancel — nothing failed, but the batch did not fully complete; branch-preserving work is untouched);
  • Some(Status::Done) when every node is Done.