WaitFor WaitFor

yaml
type: "io.kestra.plugin.core.flow.WaitFor"

Run a list of tasks repeatedly until the expected condition is met.

Use this task if your workflow requires blocking calls polling for a job to finish or for some external API to return a specific HTTP response.

You can access the outputs of the nested tasks in the condition property. The condition is evaluated after all nested task runs finish.

Examples

Run a task until it returns a specific value. Note how you don't need to take care of incrementing the iteration count. The task will loop and keep track of the iteration outputs behind the scenes — you only need to specify the exit condition for the loop.

yaml
id: wait_for
namespace: company.team

tasks:
  - id: loop
    type: io.kestra.plugin.core.flow.WaitFor
    condition: "{{ outputs.return.value == '4' }}"
    tasks:
      - id: return
        type: io.kestra.plugin.core.debug.Return
        format: "{{ outputs.loop.iterationCount }}"

Properties

condition

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️

The condition expression that should evaluate to true or false.

Boolean coercion allows 0, -0, null and '' to evaluate to false; all other values will evaluate to true.

tasks

  • Type: array
  • SubType: Task
  • Dynamic:
  • Required: ✔️

checkFrequency

  • Type: WaitFor-CheckFrequency
  • Dynamic:
  • Required:
  • Default: {maxIterations=100, maxDuration=3600.000000000, interval=1.000000000}

Check the frequency configuration.

errors

  • Type: array
  • SubType: Task
  • Dynamic:
  • Required:

List of tasks to run if any tasks failed on this FlowableTask.

failOnMaxReached

  • Type: boolean
  • Dynamic:
  • Required:
  • Default: false

If set to true, the task run will end in a failed state once the maxIterations or maxDuration are reached.

Outputs

iterationCount

  • Type: integer
  • Required:

Definitions

io.kestra.plugin.core.flow.WaitFor-CheckFrequency

Properties

interval
  • Type: string
  • Dynamic:
  • Required:
  • Default: 1.000000000
  • Format: duration

Interval between each iteration.

maxDuration
  • Type: string
  • Dynamic:
  • Required:
  • Default: 3600.000000000
  • Format: duration

Maximum duration of the task.

maxIterations
  • Type: integer
  • Dynamic:
  • Required:
  • Default: 100

Maximum count of iterations.

Was this page helpful?