Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Airflow on a specific day_of_month at a certain time?

I am trying to run Airflow on the 2nd of every month at 11.00am, but I am failing to do so. My settings are:

default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'start_date': today_date,
    'email': ['mymail'],
    'email_on_failure': True,
    'email_on_retry': True,
    'retries': 1,
    'retry_delay': timedelta(minutes=7),
}

dag = DAG('my_dag', default_args=default_args, schedule_interval='00 11 02 * *')

Airflow works flawlessly when I run a DAG on a daily basis:

schedule_interval='00 11 * * *'

but I don't seem to be able to make it work for a monthly basis :(

thanks!

like image 397
vrivesmolina Avatar asked Aug 30 '25 17:08

vrivesmolina


1 Answers

If you want to run your dag on 2nd of every month at 11.00am. you can use this code.

schedule_interval = '0 11 2 * *'

dag_name = DAG(
    'DAG_ID',
    default_args=default_args,
    schedule_interval=schedule_interval,
)

in the schedule interval 0 refers minute, 11 refers hour, 2 refers day of month, * refers any month, and next * refers any day of week.

for more scheduler Information check this website. https://crontab.guru/#0_11_2__

like image 66
Saud Bin Habib Avatar answered Sep 07 '25 14:09

Saud Bin Habib