6

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

Alexis.Rolland
  • 5,724
  • 6
  • 50
  • 77

2 Answers2

11

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>

Update: The command airflow unpause has been removed.

You should now use

$ airflow dags unpause <dag_id>

instead of

$ airflow unpause <dag_id>
Basem Gaber
  • 43
  • 1
  • 7
Alexis.Rolland
  • 5,724
  • 6
  • 50
  • 77
3

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?

Chengzhi
  • 2,531
  • 2
  • 27
  • 41
  • Yes your assumption is correct. What I mean by a new version of a DAG is I update an existing dag_id. The solution you propose could have been an option indeed but in my case I do not have access to airflow.cfg, and because it’s a mutualized instance of Airflow, other users might not want to change the ‘dags_are_paused_at_creation’ setting. By the way, do you know if versioning a DAG actually counts as a creation? Thank you – Alexis.Rolland Nov 24 '17 at 00:26