ForEach Task

Iterator task will go through an input list or dictionary and will trigger tasks connected to the yellow port.

Each iteration will provide the following variables:

tab

Input
Python list or dictionary. If a string is provided, it will be decoded as a json component.

Iterate if
Triggers the yellow port only if condition is verified. This parameter is evaluated before each iteration, and loop_index is incremented even if iteration is not triggered.

Pseudo code equivalent


    For_each value in INPUT  

      If ITERATE_IF is True
        Execute Yellow port
      Else
        Next value
        loop_index = loop_index + 1

Max running
Defines the maximum concurrent iterations. If greater than 1, iterator will trigger a batch of n iterations and wait for termination of the first one before triggering another one. Note that an iteration could be composed of various links, like the following example.

tab

In this case, 2 iterations will be triggered at the same time:

Iteration loop_index 0:
- trigger task A
- trigger task B

Iteration loop_index 1:
- trigger task A
- trigger task B

Once an iteration is terminated (i.e tasks A and B are ended), a next one is triggered to reach max running iterations.

NB: there is no guaranty about the tasks order when iterations are triggered (task A could be started after task B).

Iterate for each link
tab

Instead of triggering all linked tasks for 1 iteration, this parameter will trigger 1 iteration by linked task. Each task will receive a unique loop_index, and a new iteration will be triggered as soon as a previous one is terminated.

The previous example will generate the following output.

tab

Batch size
If greater than 1, each loop_value will be a subset of n input elements.

tab

This example will produce 4 iterations with the following loop_value.

tab

Note:

Sleep
Defines the amount of execution sleep time between each iteration.