Reputation: 6871
In Airflow 1.10.10, when a disabled DAG is enabled by pressing the button to change it's state from Off
to On
, the DAG will always run once before the next scheduled run time.
Is it possible to set a DAG to be enabled, but not make its first run until the next time it is scheduled to be run?
Currently, I need to quickly kill the DAG run after I toggle its state to be On
.
Upvotes: 7
Views: 4296
Reputation: 493
If it is daily task - set start date as below : This will prevent your DAG from running immediately after enabling.
default_args = {
'start_date': airflow.utils.dates.days_ago(1)
}
If it is a monthly task - set start date as below :
default_args = {
'start_date': airflow.utils.dates.days_ago(30)
}
Upvotes: 1
Reputation: 21192
You should set the start_date (which is a datetime
) to value after now
.
According to the docs
Upvotes: 2