Schedule a DAG in airflow to run every 5 minutes

六眼飞鱼酱① 提交于 2019-12-06 01:30:09

问题


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 ?


回答1:


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




回答2:


The documentation states:

Each DAG may or may not have a schedule, which informs how DAG Runs are created. schedule_interval is defined as a DAG arguments, and receives preferably a cron expression as a str, or a datetime.timedelta object.

When following the provided link for CRON expressions it appears you can specify it as 5 0 0 0 0 0 to run it every 5 minutes.

I'm not familiar on the matter, but this is what the documentation states.



来源:https://stackoverflow.com/questions/45689391/schedule-a-dag-in-airflow-to-run-every-5-minutes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!