Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is it possible to trigger an Airflow 2 dag from an Airflow 1 dag, and viceversa?

We are doing a migration between new and old Airflow and we were trying to implement a trigger from Airflow1 to Airflow2(and vice-versa), is it possible?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Since running Airflow 1 code in an Airflow 2 instance will likely result in errors, I assume you intend to have two Airflow instances? One running Airflow 1, and one running Airflow 2, where the Airflow 2 DAGs trigger Airflow 1 DAGs?

To trigger a DAG externally, such as another Airflow instance, you can use the REST API or CLI to trigger DAGs:

CLI (docs):

airflow dags trigger DAG_ID
# For example:
airflow dags trigger mydag-airflow1

REST API (docs):

curl -X POST http://localhost:8080/api/v1/dags/mydag-airflow1/dagRuns

Couple of things to note:

  • REST API and CLI were rewritten in Airflow 2. If you intend to trigger from Airflow 1 to 2, you must look up the respective command for the old REST API/CLI.
  • Maintaining codebases for different versions can quickly become messy. I’d advise to stick to one Airflow version.
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading