EachParallel
type: "io.kestra.core.tasks.flows.EachParallel"
Execute a tasks for a list of value in parallel.
For each value
, tasks
will be executed
The value must be valid json string representing an arrays, like ["value1", "value2"]
or [{"key":"value1"}, {"key":"value2"}]
The current value is available on vars {{ taskrun.value }}
.
The task list will be executed in parallel, for example if you have a 3 value with each one 2 tasks, all the 6 tasks will be computed in parallel with out any garantee on the order.
If you want to have each value in parallel, but no concurrent task for each value, you need to wrap the tasks with a Sequential
tasks
# Examples
id: "each_parallel"
type: "io.kestra.core.tasks.flows.EachParallel"
value: '["value 1", "value 2", "value 3"]'
tasks:
- id: each-value
type: io.kestra.core.tasks.debugs.Return
format: "{{ task.id }} with current value '{{ taskrun.value }}'"
Handling each value in parralel but only 1 child task for each value at the same time.
id: "each_parallel"
type: "io.kestra.core.tasks.flows.EachParallel"
value: '["value 1", "value 2", "value 3"]'
tasks:
- id: seq
type: io.kestra.core.tasks.flows.Sequential
tasks:
- id: t1
type: io.kestra.core.tasks.scripts.Bash
commands:
- 'echo "{{task.id}} > {{ parents[0].taskrun.value }}
- 'sleep 1'
- id: t2
type: io.kestra.core.tasks.scripts.Bash
commands:
- 'echo "{{task.id}} > {{ parents[0].taskrun.value }}
- 'sleep 1'
# Properties
# concurrent
- Type: integer
- Dynamic: ❌
- Required: ✔️
- Default:
0
Number of concurrent parrallels tasks
If the value is 0
, no limit exist and all the tasks will start at the same time
# errors
- Type: array
- SubType: Task
- Dynamic: ❌
- Required: ❌
List of tasks to run if any tasks failed on this FlowableTask
# tasks
- Type: array
- SubType: Task
- Dynamic: ❌
- Required: ❌
# value
- Type: string
- Dynamic: ✔️
- Required: ✔️
- Min length:
1