airflow.operators.trigger_dagrun

Module Contents

Classes

TriggerDagRunLink

Operator link for TriggerDagRunOperator. It allows users to access

TriggerDagRunOperator

Triggers a DAG run for a specified dag_id

Attributes

XCOM_EXECUTION_DATE_ISO

XCOM_RUN_ID

airflow.operators.trigger_dagrun.XCOM_EXECUTION_DATE_ISO = trigger_execution_date_iso[source]
airflow.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.operators.trigger_dagrun.TriggerDagRunOperator(*, trigger_dag_id, trigger_run_id=None, conf=None, execution_date=None, reset_dag_run=False, wait_for_completion=False, poke_interval=60, allowed_states=None, failed_states=None, **kwargs)[source]

Bases: airflow.models.BaseOperator

Triggers a DAG run for a specified dag_id

Parameters
  • trigger_dag_id (str) -- The dag_id to trigger (templated).

  • trigger_run_id (Optional[str]) -- The run ID to use for the triggered DAG run (templated). If not provided, a run ID will be automatically generated.

  • conf (Optional[Dict]) -- Configuration for the DAG run (templated).

  • execution_date (Optional[Union[str, datetime.datetime]]) -- Execution date for the dag (templated).

  • reset_dag_run (bool) -- Whether or not clear existing dag run if already exists. This is useful when backfill or rerun 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 (Optional[List]) -- List of allowed states, default is ['success'].

  • failed_states (Optional[List]) -- List of failed or dis-allowed states, default is None.

template_fields :Sequence[str] = ['trigger_dag_id', 'trigger_run_id', 'execution_date', 'conf'][source]
template_fields_renderers[source]
ui_color = #ffefeb[source]

Return operator extra links

execute(self, context)[source]

This is the main method to derive when creating an operator. Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

Was this entry helpful?