Assembles two or more (or single) slurm_stage() definitions into a directed
acyclic graph (DAG), verifying unique stage names, valid upstream references,
and acyclicity via Kahn's topological sort. Supports linear chains, fan-out,
fan-in, and diamond DAGs.
Arguments
- ...
One or more
slurmpilot_stageobjects created byslurm_stage().- stages
Optional list of
slurmpilot_stageobjects (alternative to passing stages via...).- name
Character pipeline name (sanitized for SLURM job prefixes). Default
"slurmpilot_pipeline".
Value
An S3 object of class "slurmpilot_pipeline" containing name,
stages, order (topological execution order), levels (DAG depth per
stage), roots, sinks, and edges (tibble of from -> to edges).
Examples
s1 <- slurm_stage("branch_a", fun = function(x) x + 1, args_list = list(1, 2))
s2 <- slurm_stage("branch_b", fun = function(x) x * 10, args_list = list(1, 2))
s3 <- slurm_stage(
"combine",
fun = function(up) sum(up$branch_a) + sum(up$branch_b),
depends_on = c("branch_a", "branch_b")
)
pipe <- slurm_pipeline(s1, s2, s3, name = "diamond_demo")
print(pipe)
#>
#> ── slurmpilot Pipeline DAG: diamond_demo
#> • Stages: 3 | Edges: 2 | Roots: branch_a, branch_b | Sinks: combine
#> • Topological order: branch_a -> branch_b -> combine
