Skip to main content

runx_core/state_machine/sequential_graph/
state.rs

1use super::super::types::{
2    GraphStatus, GraphStepStatus, SequentialGraphState, SequentialGraphStepDefinition,
3    SequentialGraphStepState,
4};
5
6#[must_use]
7pub fn create_sequential_graph_state(
8    graph_id: impl Into<String>,
9    steps: &[SequentialGraphStepDefinition],
10) -> SequentialGraphState {
11    SequentialGraphState {
12        graph_id: graph_id.into(),
13        status: GraphStatus::Pending,
14        steps: steps
15            .iter()
16            .map(|step| SequentialGraphStepState {
17                step_id: step.id.clone(),
18                status: GraphStepStatus::Pending,
19                attempts: 0,
20                started_at: None,
21                completed_at: None,
22                receipt_id: None,
23                outputs: None,
24                error: None,
25            })
26            .collect(),
27    }
28}