Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Airflow: Set dag to not be automatically scheduled

Tags:

airflow

When I create a new dag, I have to go into the UI and click on the 'schedule' toggle to turn scheduling off. How can I do this without needing to use the UI? Is there an option in the DAG constructor itself?

airflow scheduling button

In other words: how do I turn those buttons above to 'Off' in my DAG file?

like image 258
conradlee Avatar asked Nov 07 '18 14:11

conradlee


People also ask

How do I change the DAG schedule in Airflow?

To schedule a dag, Airflow just looks for the last execution date and sum the schedule interval . If this time has expired it will run the dag. You cannot simple update the start date. A simple way to do this is edit your start date and schedule interval , rename your dag (e.g. xxxx_v2.py) and redeploy it.

How do you pause a DAG Airflow?

In the DAGs view you can: Pause/unpause a DAG with the toggle to the left of the DAG name. Filter the list of DAGs to show active, paused, or all DAGs. Trigger, refresh, or delete a DAG with the buttons in the Actions section.


1 Answers

There is no way to set a DAG as disabled within a DAG file. You can mimic the behavior by temporarily setting the DAG's schedule_interval to None. You can also set the airflow configuration value dags_are_paused_at_creation to True if you want to make sure all new DAGs to be off by default. You'll need to then turn new DAGs on manually in the UI when they are ready to be scheduled.

like image 175
Daniel Huang Avatar answered Oct 06 '22 18:10

Daniel Huang