Skip to content

Concurrent For Each Loop

Executes a subgraph concurrently for each element in an iterable (e.g., an array or map).

This node iterates over each element of an input iterable (like an array or map) and executes the logic connected to its Body output in parallel.

Concurrency#

The number of parallel executions is determined by the Worker Count input. Due to the parallel nature, the order in which items are processed is not guaranteed.

Note: If concurrency is disabled in the system settings, this node will run sequentially (one item at a time), effectively ignoring the Worker Count setting.

Outputs per Iteration#

For each item, the following outputs are available within the Body execution branch: - key: The item's index (if the input is an array) or key (if the input is a map). - value: The item's value.

Execution Flow#

  1. The loop starts when the exec input is triggered.
  2. The Body output executes for each item, up to Worker Count times in parallel.
  3. Once all items have been processed successfully, the Completed output is executed.
  4. If an error occurs in any iteration, the node will attempt to stop all other parallel executions and the Completed output will not be executed.

Inputs#

Port Description
Starts the concurrent loop.
invalid port type: iterable Iterable
The array or map to iterate over.
Worker Count
The number of parallel executions. If system-wide concurrency is disabled, the loop runs sequentially.

Outputs#

Port Description
Body
Executes for each item. The order of execution is not guaranteed.
Key
The index (for an array) or key (for a map) of the current item.
Value
The value of the current item.
Completed
Executes once after all items have been processed without errors.

ID: core/concurrent-for-each-loop@v1