How to define a DAG that scheduler a monthly job together with a daily job?

后端 未结 1 609
温柔的废话
温柔的废话 2020-12-07 05:31

I have to

  • update a table Foo monthly
  • and another table Bar daily
  • and join these two tables daily and insert the res
相关标签:
1条回答
  • 2020-12-07 06:12

    This behaviour can be achieved within single DAG using either of following alternatives

    • ShortCircuitOperator
    • AirflowSkipException (better in my opinion)

    Basically, your DAG would still run each day (schedule_interval='@daily'), but

    • on a daily basis, only your Bar task would run while Foo would get skipped (or short-circuited);
    • until on some particular day (like 5th of each month) when both would run.

    You can, of course, also model these as separate DAGs and chain them together (rather than individual tasks within a single DAG). This choice might be better as long as the number of DAGs that you are linking together is small.


    Related: Schedule airflow job bi-weekly

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