How to pause or disable a DAG?
Hi,
My understanding is that the scheduler runs task instances in the DAGs that it finds in the dags_folder. Then again, besides my own DAGs in that folder, it also seems to run the example DAGs that ship with Airflow, in say the /usr/local/lib/python2.7/dist-packages/airflow/example_dags/ folder. Suppose I want to pause the scheduling of one or more of my DAGs. How can I do this? I suppose I can delete the corresponding file(s) from my dags_folder though that seems like a rather drastic step. Moreover, how can I likewise pause or halt the scheduling of the example DAGs?
Thanks, David
You can turn off the examples in the config file seen here.
https://github.com/airbnb/airflow/blob/master/airflow/configuration.py#L14
Thanks. What about other, non-example DAGs? How do you turn those off, other than removing their files from the dag_folder?
I suppose if you set the start date of the dag to some date way in the future, you'll halt it until that time period. Dag stays in tact, but doesn't run.
Thanks.
Also if you click on one of the looking glass one the left of the dag in the dag view, you will get to a menu.
I believe it can also be accessed through https://localhost/admin/dagmodel/edit/?id=name_of_dag. The to most checkbox is called is paused. If it is checked, then the dag will stop being scheduled.
Thanks. Never knew that was there.
There are so many ways, to recap:
- pause in the UI (magnifying glass in DAGs view / checkbox), there's a version of flask_admin with a bug where you have to click "Save and Continue" for the changes to take effect
- set an end_date in the past
- set retired tasks as
adhoc=True - remove from dags_folders
- i'm not 100% setting
start_datein the future will work, I'd have to test or re-read the code...