arcee123
arcee123

Reputation: 243

Airflow DAG Not following schedule

I have a DAG that is scheduled once a month. my problem is that the scheduler is not kicking off the job:

args = {
    'owner': 'Airflow',
    'start_date': dates.days_ago(1),
    'email': ['[email protected]', '[email protected]'],
    'email_on_failure': True,
    'email_on_success': True,
}

dag = models.DAG(
    dag_id='Offrs_TAX_ASSESSOR_MASTER_Production',
    default_args=args,
    schedule_interval= '0 0 1 * *',
    catchup=False
)

I tried 0 0 1 * * and I tried @Monthly. It is not firing. The DAG works perfectly when executed manually. Do I have something set wrong?

Thanks!

Upvotes: 3

Views: 352

Answers (1)

Elad Kalif
Elad Kalif

Reputation: 16089

Do not use dynamic values in start_date.

args = {
    'owner': 'Airflow',
    'start_date': datetime(2021, 4, 1),
    'email': ['[email protected]', '[email protected]'],
    'email_on_failure': True,
    'email_on_success': True,
}

In simple words Airflow calculates start_date+schedule_interval and execute the task at the end of the interval. When you use dynamic start_date you might get a case where the interval never end as the base point is always moving. This is explained in depth at the docs.

Upvotes: 1

Related Questions