2

The scheduling in Airflow can be kind of tricky and is certainly different from cron scheduling. I want to schedule a DAG on two specific days per month which is possible with following cron expression 0 0 12,25 * *

I tried the schedule interval equal to this cron expression.

For example schedule_interval='0 0 12,25 * *', but that doesn't appear to work.

I am wondering if this kind of schedule is supported by Airflow within a single DAG? What approach could I take to schedule a DAG on two specific days each month?

felix
  • 97
  • 9
  • According to the docs (https://airflow.apache.org/scheduler.html) this should work. If you set the trigger to one of the presets (i.e. @hourly or something) does it work? – PirateNinjas Aug 21 '19 at 09:37
  • for very complex scheduling rules, you can do something like [this](https://stackoverflow.com/questions/55002234/apache-airflow-delay-a-task-for-some-period-of-time/55003891#comment96797947_55003494). Also see [this](https://stackoverflow.com/a/57229076/3679900) and [this](https://stackoverflow.com/a/57108259/3679900) – y2k-shubham Aug 21 '19 at 09:44
  • @PirateNinjas what do you mean by setting the trigger. I want to use a custom cron expression as the schedule interval, rather than one of the presets – felix Aug 21 '19 at 15:09
  • @y2k-shubham Do you think that is required in the case? Is scheduling on a set 2 days per month supported with a single DAG? – felix Aug 21 '19 at 15:10
  • `Do you think that is required in the case?` No. I just mentioned it for these reasons **(1)** in case you have more complex scheduling rules than this one **(2)** in case you are not able to find any other solution for this one .. `Is scheduling on a set 2 days per month supported with a single DAG?` As already pointed out by **@PirateNinjas**, Airflow supports cron expressions; though I'm not sure if complex ones work or not – y2k-shubham Aug 21 '19 at 15:27

0 Answers0