apache / airflow

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows
https://airflow.apache.org/
Apache License 2.0
36.19k stars 14.05k forks source link

Dagrun "skipped" for timezone aware DAGs with schedules affected by daylight saving time #38098

Open wolfier opened 6 months ago

wolfier commented 6 months ago

What do you see as an issue?

The issue is that users are unaware of scheduling behaviour between transition of when daylight saving time is observed and when it is not.

For daylight time saving observing timezones, at the cusp of when switching between when daylight saving time is NOT observed to when it is, there is an hour that does not exist. For example, 2 AM Central Time ("America/Chicago") does not exist on March 10th 2024.

For daylight time saving observing timezones, at the cusp of when switching between when daylight saving time is observed to when it is NOT, there is an hour that is repeated. For example, 1 AM Central Time ("America/Chicago") happens twice on November 3rd 2024.

Solving the problem

A description of the effects of these impacted schedule intervals in terms of dagrun creation as that is what drives task scheduling. Without a dagrun, there are no tasks.

Anything else

No response

Are you willing to submit PR?

Code of Conduct

lopezvit commented 4 months ago

I'll try to get back to this in the future if I have time, trying to provide a better working example where this is happening, but basically these are the steps to reproduce:

  1. Create a DAG with:
    1. catchup=True
    2. hourly schedule (e.g. schedule_interval="1 5-19 * * *")
    3. start_date with a DST aware timezone in the past (e.g.: "start_date": pendulum.datetime(2020, 1, 8, 11, 8, tz="Europe/Helsinki")
  2. Schedule said DAG

It will try to catchup until the Sunday 25th of October 2020, but wont continue with the catchup after that, totally preventing the operation. As a workaround until this is fixed I changed to the fix timezone: "start_date": pendulum.datetime(2020, 1, 8, 11, 8, tz=2) Notes: maybe it is not necessary that it is daily and probably it doesn't need to start in January, but that is what I've find that it reproduces it.

shahar1 commented 1 month ago

@wolfier Would you still like to work on this issue?