brendan
brendan

Reputation: 320

In airflow, is there a good way to call another dag's task?

I've got dag_prime and dag_tertiary.

I can call the secondary one from a system call from the python operator, but i feel like there's got to be a better way. I'd also like to consider queuing the dag_tertiary calls, if there's a simple way to do that. Is there a better way than using system calls?

Thanks!

Upvotes: 13

Views: 33818

Answers (2)

SudhakarH
SudhakarH

Reputation: 551

Use TriggerDagRunOperator from airflow.operators.dagrun_operator and pass the other DAG name to triger_dag_id parameter.

Follow Airflow updated documentation dag_run_operator Airflow Documentation

Upvotes: 0

Him
Him

Reputation: 1649

Use airflow.operators.trigger_dagrun for calling one DAG from another.

The details can be found in operator trigger_dagrun Airflow documentation.

Following post gives a good example of using this operator: https://www.linkedin.com/pulse/airflow-lesson-1-triggerdagrunoperator-siddharth-anand

Upvotes: 31

Related Questions