Skip to content

Fan out

Run a body once per item, in parallel.

The body sees each element as item and its position as index. The output is the list of body outputs, in item order, whatever order they finished in. A list is capped at a hundred items.

  • Kind: fan_out
  • Palette: Flow
  • Run it on its own: no, only as part of a graph
  • The same step for every element of a list: build each target, score each row, notify each customer.
  • Calling a rate-limited API once per item, paced with rate.

When one item’s work is more than one step, make the body a workflow node, so each item is a child run you can inspect and rerun on its own.

Field Type Required Description
body any yes The node body to run for each item.
items any yes The list to iterate: a literal list, or a marker object reading one from the run, {"$expr": "input.items"}.
max_parallel integer no Cap on concurrent iterations.
on_error string no “halt” (default) or “continue” past a failed item. One of "halt", "continue".
rate object no Pace the dispatch: {limit, period}, e.g. 20 per “1m”.

Not declared: what comes out depends on the configuration.

version: hyperspool-graph/v1
nodes:
- id: build
type: fan_out
config:
items: [linux-amd64, linux-arm64, darwin-arm64]
max_parallel: 2
on_error: continue
body:
type: shell
config:
run: { $template: "make release TARGET={{ item }}" }
- id: report
type: shell
config:
run: { $template: "echo {{ size(nodes.build.output) }} targets" }
edges:
- { from: build, to: report }

Two builds run at a time. With on_error: continue a failed target leaves null in its slot and the step still succeeds; the default, halt, fails the step once the builds in flight settle. See Repeating work.

See the node reference for every other node.