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#
- The loop starts when the
execinput is triggered. - The
Bodyoutput executes for each item, up toWorker Counttimes in parallel. - Once all items have been processed successfully, the
Completedoutput is executed. - If an error occurs in any iteration, the node will attempt to stop all other parallel executions and the
Completedoutput will not be executed.
Inputs#
| Port | Description |
|---|---|
| Starts the concurrent loop. | |
invalid port type: iterable Iterable |
The array or map to iterate over. |
| The number of parallel executions. If system-wide concurrency is disabled, the loop runs sequentially. |
Outputs#
| Port | Description |
|---|---|
| Executes for each item. The order of execution is not guaranteed. | |
| The index (for an array) or key (for a map) of the current item. | |
| The value of the current item. | |
| Executes once after all items have been processed without errors. |
ID: core/concurrent-for-each-loop@v1