foreach
Run the child node for each item in the list of data.
Description
Run the child node for each item in the list of data.
The child node can be called either sequentially or concurrently.
The item in the list is passed within the flowdata.
When the flow of child_for is finished, then run children of foreach node.
Parameters
Parameter |
Type |
Required |
Default |
Comment |
---|---|---|---|---|
child_for | node |
No |
None |
Child node to be run for each item. |
item_name | str |
No |
item |
Key name of passed item in the flowdata. |
items | list |
Yes |
- |
List of elements to be processed one by one by the child node. |
mode | str |
No |
concurrent |
Set either of sequential or concurrent. |
Examples
# Print 1, 2, 3, and hello into the stdout
# Output: No output
- foreach:
name: "for"
items: [1, 2, 3]
item_name: "foo"
mode: "sequential"
- stdout:
name: "out_for"
src: "{{ fd.foo }}"
parent: "for.child_for"
- stdout:
name: "out"
src: "hello"
parent: "for"