Bhavik Thakkar
Bhavik Thakkar

Reputation: 39

Airflow: Scheduling a task multiple times a day

I take input from the user about the schedule of the tasks. I want to run the task multiple times a day. How is it possible using Airflow?

Upvotes: 1

Views: 6053

Answers (1)

Zack
Zack

Reputation: 2466

You can schedule a DAG to run multiple times a day by using the schedule_interval arg in your DAG like so:

dag = DAG(
    dag_id='fake_dag',
    schedule_interval="* * * * *"
    )

schedule_interval uses CRON format. This may help you understand CRON format.

Example: if you want your DAG to run every 4 hours during a day, your DAG would look like below:

dag = DAG(
    dag_id='fake_dag',
    schedule_interval="* 0-23/4 * * *"
    )

Upvotes: 2

Related Questions