Monthly DAG not triggering

Hello everyone! Hope you are doing well.

We are struggling to get our Monthly DAG running. We have some others running perfectly, on a daily basis, however, the monthly one is not triggering.

Please, see the code below:

default_args = {
‘owner’: ‘airflow’,
‘retries’: 3,
‘retry_delay’: timedelta(minutes=3),
‘start_date’: airflow.utils.dates.days_ago(1),
‘email_on_failure’: False,
‘email_on_retry’: False
}

with models.DAG(
dag_id=‘monthlydag’,
tags=[‘monthly’],
default_args=default_args,
schedule_interval=“25 20 04 * *”,
catchup=False

) as dag:
start = dummy_operator.DummyOperator(
task_id=‘start’,
trigger_rule=‘all_success’
)

cloud_function = BashOperator(
    task_id='cloud_function',
    bash_command=XXXX,
    dag=dag
)

end = dummy_operator.DummyOperator(
    task_id='end',
    trigger_rule='all_done'
)

start >> cloud_function >> end

We already tried setting up a start_date with datetime package, but it didn’t triggered as well. We also used timedelta and relative delta to the schedule_interval and it didn’t work either

Please, anyone can help us in this question?
Any help/orientation is kindly appreciated

Hi @igorop, thanks for reaching out!

You have most likely solved the issue yourself but in case someone will land here looking for an answer:

The reason for this DAG not being scheduled is your start_date. The DAG is triggered after start_date/ last_run + schedule_interval. Let’s look at an example:

If your start_date is set to Jan 1, 2022 and schedule_interval="@monthly", the very first DAG Run would be scheduled at data_interval_end which is Feb 1, 2022 (= start_date + schedule_interval).

Also, please keep in mind that your start_date should be static to make sure the DAG Runs are populated as expected.

1 Like

This was helpful for me today. Thank you!

2 Likes