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?
In other words: how do I turn those buttons above to 'Off' in my DAG file?
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With