close

How to configure Airflow dag to run at specific time on daily basis?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to configure Airflow dag to run at specific time on daily basis in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to configure Airflow dag to run at specific time on daily basis?

  1. How to configure Airflow dag to run at specific time on daily basis?

    The Month is the third parameter and if you do a 2 30 */2 * * it will run every other day (at 2:30am). It calculates it a little weird sometimes depending on the month.

  2. configure Airflow dag to run at specific time on daily basis

    The Month is the third parameter and if you do a 2 30 */2 * * it will run every other day (at 2:30am). It calculates it a little weird sometimes depending on the month.

Method 1

To start a DAG for example everyday on 2:30 AM in the morning you can do the following:

DAG(
   dag_id='dag_id',
   # start date:28-03-2017
   start_date= datetime(year=2017, month=3, day=28),
   # run this dag at 2 hours 30 min interval from 00:00 28-03-2017
   schedule_interval='30 2 * * *')

Method 2

The Month is the third parameter and if you do a 2 30 */2 * * it will run every other day (at 2:30am). It calculates it a little weird sometimes depending on the month. You can force it to run even or odd days by specifying the range:

# Will only run on odd days:
2 30 1-31/2 * * command

# Will only run on even days:
2 30 2-30/2 * * command

Conclusion

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read