EachSequential
EachSequential
⚠ This feature is deprecated and will be removed in the future. We encourage you to migrate to the new plugin, but you can still use the deprecated version.
type: "io.kestra.plugin.core.flow.EachSequential"
For each value in the list, execute one or more tasks sequentially.
This task is deprecated, please use the io.kestra.plugin.core.flow.ForEach
task instead.
The list of tasks
will be executed for each item sequentially. The value must be a valid JSON string representing an array, e.g. a list of strings ["value1", "value2"]
or a list of dictionaries [{"key": "value1"}, {"key": "value2"}]
.
You can access the current iteration value using the variable {{ taskrun.value }}
. The task list will be executed sequentially for each item.
We highly recommend triggering a subflow for each value. This allows much better scalability and modularity. Check the flow best practices documentation and the following Blueprint for more details.
Examples
The taskrun.value from the
each_sequential
task is available only to immediate child tasks such as thebefore_if
and theif
tasks. To access the taskrun value in child tasks of theif
task (such as in theafter_if
task), you need to use the syntax{{ parent.taskrun.value }}
as this allows you to access the taskrun value of the parent taskeach_sequential
.
id: loop_example
namespace: company.team
tasks:
- id: each_sequential
type: io.kestra.plugin.core.flow.EachSequential
value: ["value 1", "value 2", "value 3"]
tasks:
- id: before_if
type: io.kestra.plugin.core.debug.Return
format: 'Before if {{ taskrun.value }}'
- id: if
type: io.kestra.plugin.core.flow.If
condition: '{{ taskrun.value == "value 2" }}'
then:
- id: after_if
type: io.kestra.plugin.core.debug.Return
format: "After if {{ parent.taskrun.value }}"
This task shows that the value can be a bullet-style list. The task iterates over the list of values and executes the
each_value
child task for each value.
id: each_sequential_flow
namespace: company.team
tasks:
- id: each_sequential
type: io.kestra.plugin.core.flow.EachSequential
value:
- value 1
- value 2
- value 3
tasks:
- id: each_value
type: io.kestra.plugin.core.debug.Return
format: "{{ task.id }} with value '{{ taskrun.value }}'"
Properties
value
- Type:
- string
- array
- Dynamic: ✔️
- Required: ✔️
The list of values for this task.
The value car be passed as a string, a list of strings, or a list of objects.
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: ❌
Outputs
Definitions
Was this page helpful?