ivan-afonichkin opened a new pull request, #35445:
URL: https://github.com/apache/airflow/pull/35445
Airflow scheduler is getting stuck for the following DAG:
```
from airflow.decorators import task
import pendulum
from airflow.models import DAG
from datetime import timedelta
default_args = {
"depends_on_past": False,
"start_date": pendulum.datetime(year=2023, month=10, day=28,
tz="Europe/Brussels"),
"email": [],
"email_on_failure": False,
"email_on_retry": False,
"retries": 3,
"retry_delay": timedelta(minutes=5),
}
with DAG(
"time-zone-issue",
default_args=default_args,
max_active_runs=1,
schedule_interval="0,15,30,45 6-22 * * *",
) as dag:
@task(task_id="print_the_context")
def print_context(ds=None, **kwargs):
"""Print the Airflow context and ds variable from the context."""
print(ds)
return "finished!"
run_this = print_context()
```
Scheduler keeps switching between two incorrect states:
```
test-airflow-scheduler-1 | [2023-10-30T12:50:08.811+0000] {dag.py:3722}
INFO - Setting next_dagrun for time-zone-issue to 2023-10-29T04:00:00+00:00,
run_after=2023-10-29T05:00:00+00:00
test-airflow-scheduler-1 | [2023-10-30T12:50:09.671+0000] {dag.py:3722}
INFO - Setting next_dagrun for time-zone-issue to 2023-10-28T21:45:00+00:00,
run_after=2023-10-29T04:00:00+00:00
test-airflow-scheduler-1 | [2023-10-30T12:50:10.793+0000] {dag.py:3722}
INFO - Setting next_dagrun for time-zone-issue to 2023-10-29T04:00:00+00:00,
run_after=2023-10-29T05:00:00+00:00
test-airflow-scheduler-1 | [2023-10-30T12:50:11.894+0000] {dag.py:3722}
INFO - Setting next_dagrun for time-zone-issue to 2023-10-28T21:45:00+00:00,
run_after=2023-10-29T04:00:00+00:00
test-airflow-scheduler-1 | [2023-10-30T12:50:12.813+0000] {dag.py:3722}
INFO - Setting next_dagrun for time-zone-issue to 2023-10-29T04:00:00+00:00,
run_after=2023-10-29T05:00:00+00:00
```
Note than in Belgium Oct, 29 is CEST (UTC+1), while Oct, 28 is CET (UTC+2)
due to Daylight Saving Time (DST).
From the DAG above it looks like "2023-10-29T04:00:00+00:00" is an incorrect
state as it is Oct, 29 5am CEST, which was never a part of the scheduling
interval, while specifying the DAG.
After the fix scheduling proceeds as expected, I will attach screenshots for
3 intervals:
1. Oct, 28 20:30 UTC - Oct, 28 20:45 UTC

2. Oct, 28 20:45 UTC - Oct, 29 05:00 UTC

3. Oct, 29 05:00 UTC - Oct, 29 05:15 UTC

closes: [#35272](https://github.com/apache/airflow/issues/35272)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]