Core Plugins and tasks Flow

Core Plugins and tasks Flow

Certified

Trigger a Flow based on other Flows’ executions.

Fires when upstream Flow executions meet dependsOn (required) and optional trigger when condition. Lets you chain Flows owned by different teams.

Upstream execution outputs are exposed under trigger.outputs; you can also pass inputs to the downstream Flow.

yaml
type: io.kestra.plugin.core.trigger.Flow
  1. Trigger the transform flow after the extract flow finishes successfully. The extract flow generates a date output that is passed to the transform flow as an input.
id: extract
namespace: company.team

tasks: 
  - id: final_date
    type: io.kestra.plugin.core.debug.Return
    format: "{{ execution.startDate | dateAdd(-2, 'DAYS') | date('yyyy-MM-dd') }}"

outputs: 
  - id: date
    type: STRING
    value: "{{ outputs.final_date.value }}"

The transform flow is triggered after the extract flow finishes successfully.

yaml
id: transform
namespace: company.team

inputs:
  - id: date
    type: STRING
    defaults: "2025-01-01"

variables:
  result: |
    Ingestion done in {{ trigger.executionId }}.
    Now transforming data up to {{ inputs.date }}

tasks:
  - id: run_transform
    type: io.kestra.plugin.core.debug.Return
    format: "{{ render(vars.result) }}"

  - id: log
    type: io.kestra.plugin.core.log.Log
    message: "{{ render(vars.result) }}"

triggers:
  - id: run_after_extract
    type: io.kestra.plugin.core.trigger.Flow
    inputs:
      date: "{{ trigger.outputs.date }}"
    dependsOn:
      - namespace: company.team
        flowId: extract
        states: [SUCCESS]

  1. Trigger the silver_layer flow once the bronze_layer flow finishes successfully by 9 AM Paris time.
id: bronze_layer
namespace: company.team

tasks: 
  - id: raw_data
    type: io.kestra.plugin.core.log.Log
    message: Ingesting raw data
yaml
id: silver_layer
namespace: company.team

tasks:
  - id: transform_data
    type: io.kestra.plugin.core.log.Log
    message: deduplication, cleaning, and minor aggregations

triggers:
  - id: flow_trigger
    type: io.kestra.plugin.core.trigger.Flow
    window:
      deadline: "09:00:00"
      timezone: Europe/Paris
    dependsOn:
      - namespace: company.team
        flowId: bronze_layer
        states: [SUCCESS]

  1. Create a System Flow to send a Slack alert on any failure or warning state within the company namespace. This example uses the Slack webhook secret to notify the #general channel about the failed flow.
yaml
id: alert
namespace: system

tasks:
  - id: send_alert
    type: io.kestra.plugin.notifications.slack.SlackExecution
    url: "{{secret('SLACK_WEBHOOK')}}" # format: https://hooks.slack.com/services/xzy/xyz/xyz
    channel: "#general"
    executionId: "{{trigger.executionId}}"

triggers:
  - id: alert_on_failure
    type: io.kestra.plugin.core.trigger.Flow
    states:
      - FAILED
      - WARNING
    when: "{{flow.namespace | startsWith('company')}}"

  1. Create a System Flow to send a Sentry issue on any failure or warning state within the company.payroll namespace. This example uses the Sentry Execution task and a Flow trigger with dependsOn.
yaml
id: sentry_execution_example
namespace: company.team

tasks:
- id: send_alert
  type: io.kestra.plugin.notifications.sentry.SentryExecution
  executionId: "{{ trigger.executionId }}"
  transaction: "/execution/id/{{ trigger.executionId }}"
  dsn: "{{ secret('SENTRY_DSN') }}"
  level: ERROR

triggers:
- id: failed_prod_workflows
  type: io.kestra.plugin.core.trigger.Flow
  dependsOn:
  - states
      - FAILED
      - WARNING
    namespace: company.payroll

  1. Chain two different flows (flow_a and flow_b) and trigger flow_b only after flow_a completes successfully with matching labels. Note that this example shows two separate flows.
yaml
id: flow_a
namespace: company.team
labels:
  type: orchestration
tasks:
  - id: hello
    type: io.kestra.plugin.core.log.Log
    message: Hello World!
---
id: flow_b
namespace: company.team
tasks:
  - id: hello
    type: io.kestra.plugin.core.log.Log
    message: Hello World!
triggers:
  - id: on_completion
    type: io.kestra.plugin.core.trigger.Flow
    dependsOn:
      - namespace: company.team
        flowId: flow_a
        states: [SUCCESS]
        labels:
          type: orchestration
Properties
Defaultfalse

Specifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.

Dependencies on upstream flow executions

Express dependencies on upstream flow executions, which must be met for the flow trigger to be evaluated.

Definitions
flowIdstring

The flow ID

labelsobject

A key/value map of labels

namespacestring

The namespace of the flow

statesarray
SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

The execution states

whenstring
Defaulttrue

A condition that determines whether the trigger should run for that dependency.

A Pebble expression evaluated at trigger time. The trigger fires only when the expression evaluates to a truthy value (true, a non-empty string, a non-zero number). Use this to gate trigger execution on dynamic runtime values such as execution labels, flow variables, or environment conditions.

Pass upstream flow's outputs to inputs of the current flow.

The inputs property passes data objects or a file to the downstream flow as long as those outputs are defined on the flow-level in the upstream flow. ::alert{type="warning"} Make sure that the inputs and task outputs defined in this Flow trigger match the outputs of the upstream flow. Otherwise, the downstream flow execution will not to be created. If that happens, go to the Logs tab on the Flow page to investigate the error. ::

Minimum>

Minimum number of satisfied dependsOn conditions for AT_LEAST mode

When mode is set to AT_LEAST, this specifies the minimum number of conditions that must be satisfied within the window.

DefaultALL
Possible Values
ALLANYAT_LEAST

Mode for evaluating dependsOn conditions

Specifies how the dependsOn conditions should be evaluated: ALL, ANY, or AT_LEAST. When using AT_LEAST, you must also set minSatisfied to the minimum number of conditions that must be satisfied within the window.

SubTypestring
Default[ "SUCCESS", "WARNING", "FAILED", "KILLED", "CANCELLED", "RETRIED", "SKIPPED", "RESUBMITTED", "PAUSED" ]
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

List of execution states that will be evaluated by the trigger

By default, only executions in a terminal state or in the PAUSED state will be evaluated. Note that a Flow trigger cannot react to the CREATED state because the Flow trigger reacts to state transitions. The CREATED state is the initial state of an execution and does not represent a state transition. ::alert{type="info"} The trigger will be evaluated for each state change of matching executions. If a flow has two Pause tasks, the execution will transition from PAUSED to a RUNNING state twice — one for each Pause task. In this case, a Flow trigger listening to a PAUSED state will be evaluated twice. ::

SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

List of execution states after which a trigger should be stopped (a.k.a. disabled).

Defaulttrue

A condition that determines whether the trigger should run.

A Pebble expression evaluated at trigger time. The trigger fires only when the expression evaluates to a truthy value (true, a non-empty string, a non-zero number). Use this to gate trigger execution on dynamic runtime values such as execution labels, flow variables, or environment conditions.

Window configuration for the dependsOn trigger

Configure the time window within which all dependsOn conditions must be met.

Definitions

Defines the time window within which all dependsOn conditions must be met for the trigger to fire. The window type is inferred from the fields that are set:

  • deadline set: daily time deadline window (conditions must be met before the given time each day).
  • from and to both set: daily time window (conditions must be met within the given time range each day).
  • lookback set: sliding window (conditions must be met within the past duration).
  • otherwise: duration window (default, conditions must be met within a fixed duration, configurable via every and offset). deadline, from, to, every and offset are resolved daily/midnight boundaries anchored on timezone (defaults to the server timezone); lookback is unaffected by timezone.
deadlinestring
Formatpartial-time

Daily deadline

Use this to define a DAILY_TIME_DEADLINE window: the dependsOn conditions must be met before this time each day. Mutually exclusive with from, to, lookback, every, and offset.

everystring
Formatduration

Duration window size

Use this to define the size of a DURATION_WINDOW: the dependsOn conditions must be met within a fixed-duration window that advances at the given interval. Defaults to 1 day. Mutually exclusive with deadline, from, to, and lookback.

fromstring
Formatpartial-time

Daily window start time

Use this together with to to define a DAILY_TIME_WINDOW: the dependsOn conditions must be met within the time range [from, to] each day. Mutually exclusive with deadline, lookback, every, and offset.

lookbackstring
Formatduration

Sliding window lookback duration

Use this to define a SLIDING_WINDOW: the dependsOn conditions must be met within the past duration relative to the current time. Mutually exclusive with deadline, from, to, every, and offset.

offsetstring
Formatduration

Duration window offset

Use this to shift the start of the DURATION_WINDOW relative to midnight. For example, PT6H shifts the window start by 6 hours when combined with a 1-day every. Mutually exclusive with deadline, from, to, and lookback.

timezonestring

The timezone used to resolve the daily deadline, start and end times

Defaults to the server timezone. Set a time-zone ID such as Europe/Paris so that daily windows follow the intended zone, including daylight-saving transitions. Has no effect on lookback.

tostring
Formatpartial-time

Daily window end time

Use this together with from to define a DAILY_TIME_WINDOW: the dependsOn conditions must be met within the time range [from, to] each day. Mutually exclusive with deadline, lookback, every, and offset.

Formatdate-time

The execution end date

In case multiple executions triggered the current flow, this will be the last one.

The execution ID that triggered the current flow

In case multiple executions triggered the current flow, this will be the last one.

The execution labels that triggered the current flow

In case multiple executions triggered the current flow, this will be the last one.

The flow ID whose execution triggered the current flow

In case multiple executions triggered the current flow, this will be the last one.

The flow revision that triggered the current flow

In case multiple executions triggered the current flow, this will be the last one.

The namespace of the flow that triggered the current flow

In case multiple executions triggered the current flow, this will be the last one.

Formatdate-time

The execution start date

In case multiple executions triggered the current flow, this will be the last one.

Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

The execution state

In case multiple executions triggered the current flow, this will be the last one.

The first failed task ID from the execution that triggered the current flow

In case multiple executions triggered the current flow, this will be the last one.

The last task ID from the execution that triggered the current flow

In case multiple executions triggered the current flow, this will be the last one.

The extracted outputs from the flows that triggered the current flow

As there can be multiple executions that trigger this flow, each output will be prefixed by its namespace and flow ID. For example, 'namespace.flowId.key' will be the key for the output 'key' from the flow with ID 'flowId' in namespace 'namespace'.