Airflow: changing the crontab time for a DAG in Airflow

后端 未结 4 2086
灰色年华
灰色年华 2020-12-06 05:49

I have a DAG that has been running everyday at 3:00, it ran OK for the past few weeks.

I\'ve updated the date to run now at 7:00, but apparently for the last 2 days

相关标签:
4条回答
  • 2020-12-06 06:22

    You can use the same dag. After modifying schedule_interval, you need to mark the previous job as succeeded via airflow backfill -m command.

    0 讨论(0)
  • 2020-12-06 06:40

    To schedule a dag, Airflow just looks for the last execution date and sum the schedule interval. If this time has expired it will run the dag. You cannot simple update the start date. A simple way to do this is edit your start date and schedule interval, rename your dag (e.g. xxxx_v2.py) and redeploy it.

    0 讨论(0)
  • 2020-12-06 06:40

    David,
    1. You can also delete the dag via Experimental REST API. deleting a DAG
    2. Change the desired start_date.
    3. And add the same DAG back.

    0 讨论(0)
  • 2020-12-06 06:46

    An alternative solution to renaming the DAG is to edit the execution_date of all prior task instances and DAG runs of the DAG in the database. The tables to alter are task_instance and dag_run respectively.

    One of the downsides of this approach is that you will lose the ability to browse logs of completed tasks through the webserver.

    0 讨论(0)
提交回复
热议问题