I have an airflow running in cloud composer, I want to run the dag everyday except mondays.
I have setup my dag as follows but it didn't run on Tuesday.
default_args = {
'owner': 'name',
'depends_on_past': False,
'start_date': days_ago(1),
'email': ['[email protected]'],
'email_on_failure': True,
'retries': 3,
'retry_delay': timedelta(minutes=0.5),
'catchup': False
}
@dag(schedule_interval='00 04 * * 2-7', default_args=default_args)
def my_dag():
...
What I'm I missing?
In cron expressions, the days are numbered 0-6, not 1-7, so you would need to account for that. It seems that looping around like "2-0" doesn't seem to work, so I am solving this this by creating a comma-separated list, which also has better readability:
@dag(schedule_interval='0 4 * * 2,3,4,5,6,0', default_args=default_args)
Double check via Crontabguru: