

This operator allows you to have a task in one DAG that triggers another DAG in the same Airflow environment.

The TriggerDagRunOperator is a straightforward method of implementing cross-DAG dependencies from an upstream DAG. See Datasets and Data-Aware Scheduling in Airflow to learn more. One of those datasets has already been updated by an upstream DAG. The following image shows that the DAG dataset_dependent_example_dag runs only after two different datasets have been updated. In the Airflow UI, the Next Run column for the downstream DAG shows dataset dependencies for the DAG and how many dependencies have been updated since the last DAG run. Consuming DAG: A DAG that runs as soon as a specific dataset is updated.Īny task can be made into a producing task by providing one or more datasets to the outlets parameter.Producing task: A task that updates a specific dataset, defined by its outlets parameter.Using datasets requires knowledge of the following scheduling concepts: This type of dependency also provides you with increased observability into the dependencies between your DAGs and datasets in the Airflow UI.

You should use this method if you have a downstream DAG that should only run after a dataset has been updated by an upstream DAG, especially if those updates are irregular. DAGs that access the same data can have explicit, visible relationships, and DAGs can be scheduled based on updates to this data. In Airflow 2.4 and later, you can use datasets to create data-driven dependencies between DAGs. Instead, use one of the methods described in this guide. Using SubDAGs to handle DAG dependencies can cause performance issues.
Trigger airflow dag via api how to#
In this section, you'll learn how and when you should use each method and how to view dependencies in the Airflow UI. There are multiple ways to implement cross-DAG dependencies in Airflow, including: See Managing Dependencies in Apache Airflow. To get the most out of this guide, you should have an understanding of:
Trigger airflow dag via api code#
In this guide, you'll review the methods for implementing cross-DAG dependencies, including how to implement dependencies if your dependent DAGs are located in different Airflow deployments.Īll code used in this is available in the cross-dag-dependencies-tutorial registry.
