Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command Line Option to Activate Airflow DAGs

We have a continuous integration pipeline which automatically deploys our Airflow DAGs to the Airflow server. When a new version of a DAG is deployed, its status is OFF by default. We would like to turn it ON as part of the tasks executed by the deployment process.

Is there a command line option in Airflow which allows to turn ON a DAG? Thank you

like image 340
Alexis.Rolland Avatar asked Nov 22 '17 03:11

Alexis.Rolland


People also ask

What is the command to Unpause the DAG?

'trigger_dag' triggers a DAG run. That is, if the DAG is unpaused, the command will initiate a dag run. However, the DAG state is paused by default.


2 Answers

Ok it seems I did not look carefully enough. The answer is just here in Airflow Documentation

You can turn OFF a DAG with the following command:

$ airflow pause <dag_id>

You can turn ON a DAG with the following command:

$ airflow unpause <dag_id>
like image 127
Alexis.Rolland Avatar answered Sep 18 '22 22:09

Alexis.Rolland


When you say new version, I am assuming you change the DAG_ID, have you consider to update the airflow.cfg to dags_are_paused_at_creation = False?

like image 37
Chengzhi Avatar answered Sep 19 '22 22:09

Chengzhi