airflow.providers.standard.operators.trigger_dagrun

Module Contents

Classes

TriggerDagRunLink

Operator link for TriggerDagRunOperator.

TriggerDagRunOperator

Triggers a DAG run for a specified DAG ID.

Attributes

XCOM_LOGICAL_DATE_ISO

XCOM_RUN_ID

airflow.providers.standard.operators.trigger_dagrun.XCOM_LOGICAL_DATE_ISO = 'trigger_logical_date_iso'[source]
airflow.providers.standard.operators.trigger_dagrun.XCOM_RUN_ID = 'trigger_run_id'[source]

Bases: airflow.models.BaseOperatorLink

Operator link for TriggerDagRunOperator.

It allows users to access DAG triggered by task using TriggerDagRunOperator.

name = 'Triggered DAG'[source]

Link to external system.

Note: The old signature of this function was (self, operator, dttm: datetime). That is still supported at runtime but is deprecated.

Parameters
Returns

link to external system

Return type

str

class airflow.providers.standard.operators.trigger_dagrun.TriggerDagRunOperator(*, trigger_dag_id, trigger_run_id=None, conf=None, logical_date=None, reset_dag_run=False, wait_for_completion=False, poke_interval=60, allowed_states=None, failed_states=None, skip_when_already_exists=False, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), **kwargs)[source]

Bases: airflow.models.BaseOperator

Triggers a DAG run for a specified DAG ID.

Note that if database isolation mode is enabled, not all features are supported.

Parameters
  • trigger_dag_id (str) – The dag_id of the DAG to trigger (templated).

  • trigger_run_id (str | None) – The run ID to use for the triggered DAG run (templated). If not provided, a run ID will be automatically generated.

  • conf (dict | None) – Configuration for the DAG run (templated).

  • logical_date (str | datetime.datetime | None) – Logical date for the triggered DAG (templated).

  • reset_dag_run (bool) – Whether clear existing DAG run if already exists. This is useful when backfill or rerun an existing DAG run. This only resets (not recreates) the DAG run. DAG run conf is immutable and will not be reset on rerun of an existing DAG run. When reset_dag_run=False and dag run exists, DagRunAlreadyExists will be raised. When reset_dag_run=True and dag run exists, existing DAG run will be cleared to rerun.

  • wait_for_completion (bool) – Whether or not wait for DAG run completion. (default: False)

  • poke_interval (int) – Poke interval to check DAG run status when wait_for_completion=True. (default: 60)

  • allowed_states (list[str | airflow.utils.state.DagRunState] | None) – Optional list of allowed DAG run states of the triggered DAG. This is useful when setting wait_for_completion to True. Must be a valid DagRunState. Default is [DagRunState.SUCCESS].

  • failed_states (list[str | airflow.utils.state.DagRunState] | None) – Optional list of failed or disallowed DAG run states of the triggered DAG. This is useful when setting wait_for_completion to True. Must be a valid DagRunState. Default is [DagRunState.FAILED].

  • skip_when_already_exists (bool) – Set to true to mark the task as SKIPPED if a DAG run of the triggered DAG for the same logical date already exists.

  • deferrable (bool) – If waiting for completion, whether or not to defer the task until done, default is False.

template_fields: collections.abc.Sequence[str] = ('trigger_dag_id', 'trigger_run_id', 'logical_date', 'conf', 'wait_for_completion',...[source]
template_fields_renderers[source]
ui_color = '#ffefeb'[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

execute_complete(context, session, event)[source]

Was this entry helpful?