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 :
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.