Schedule a DAG in airflow to run every 5 minutes

bsd picture bsd · Aug 15, 2017 · Viewed 31.4k times · Source

I have a DAG in airflow and for now it is running each hour (@hourly). Is it possible to have it running each 5 minutes ?

Answer

Mike picture Mike · Aug 15, 2017

Yes, here's an example of a DAG that I have running every 5 min:

dag = DAG(dag_id='eth_rates',
          default_args=args,
          schedule_interval='*/5 * * * *',
          dagrun_timeout=timedelta(seconds=5))

schedule_interval accepts a CRON expression: https://en.wikipedia.org/wiki/Cron#CRON_expression