Reputation: 13695
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?
Upvotes: 8
Views: 7600
Reputation: 9284
you can set the is_paused_upon_creation=True
DAG(dag_id=dag_id,
schedule_interval='@once',
...
is_paused_upon_creation=True)
Upvotes: 5
Reputation: 1036
There's no way to set this within the DAG file, but if you're trying to enable or disable a large amount of DAGs you can run an UPDATE statement in your Airflow database: UPDATE dag SET is_paused = TRUE;
Upvotes: 1
Reputation: 6538
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.
Upvotes: 12