Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAGs scheduled on February 29th are not executed. #38174

Closed
2 tasks done
lanhhv84 opened this issue Mar 15, 2024 · 4 comments · Fixed by #38198
Closed
2 tasks done

DAGs scheduled on February 29th are not executed. #38174

lanhhv84 opened this issue Mar 15, 2024 · 4 comments · Fixed by #38198
Labels

Comments

@lanhhv84
Copy link

Apache Airflow version

2.8.3

If "Other Airflow 2 version" selected, which one?

No response

What happened?

If the DAG is scheduled on Feb 29th, it will never be executed automatically on the scheduled date.
Screenshot 2024-03-15 at 5 06 54 PM

Screenshot 2024-03-15 at 4 14 01 PM

What you think should happen instead?

A new DAG run should be created and scheduled on Feb 29th

How to reproduce

schedule_interval = "0 0 29 2 *"
dag = DAG(dag_name,
default_args={},
schedule_interval=schedule_interval,
sla_miss_callback=None,
max_active_runs=1,
concurrency=20
)

Operating System

Linux

Versions of Apache Airflow Providers

2.8.3

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

Anything else?

This is the log when I tried to force scheduling

Traceback (most recent call last):
  File "/usr/local/bin/airflow", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/airflow/__main__.py", line 57, in main
    args.func(args)
  File "/usr/local/lib/python3.8/site-packages/airflow/cli/cli_config.py", line 49, in command
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/airflow/utils/cli.py", line 114, in wrapper
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/airflow/utils/providers_configuration_loader.py", line 55, in wrapped_function
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/airflow/cli/commands/dag_command.py", line 164, in dag_trigger
    message = api_client.trigger_dag(
  File "/usr/local/lib/python3.8/site-packages/airflow/api/client/local_client.py", line 34, in trigger_dag
    dag_run = trigger_dag.trigger_dag(
  File "/usr/local/lib/python3.8/site-packages/airflow/api/common/trigger_dag.py", line 125, in trigger_dag
    triggers = _trigger_dag(
  File "/usr/local/lib/python3.8/site-packages/airflow/api/common/trigger_dag.py", line 74, in _trigger_dag
    data_interval = dag.timetable.infer_manual_data_interval(run_after=logical_date)
  File "/usr/local/lib/python3.8/site-packages/airflow/timetables/interval.py", line 166, in infer_manual_data_interval
    end = self._align_to_prev(run_after)
  File "/usr/local/lib/python3.8/site-packages/airflow/timetables/_cron.py", line 141, in _align_to_prev
    prev_time = self._get_prev(current)
  File "/usr/local/lib/python3.8/site-packages/airflow/timetables/_cron.py", line 118, in _get_prev
    scheduled = cron.get_prev(datetime.datetime)
  File "/usr/local/lib/python3.8/site-packages/croniter/croniter.py", line 129, in get_prev
    return self._get_next(ret_type or self._ret_type, is_prev=True)
  File "/usr/local/lib/python3.8/site-packages/croniter/croniter.py", line 205, in _get_next
    result = self._calc(self.cur, expanded,
  File "/usr/local/lib/python3.8/site-packages/croniter/croniter.py", line 463, in _calc
    raise CroniterBadDateError("failed to find prev date")

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@lanhhv84 lanhhv84 added area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet labels Mar 15, 2024
Copy link

boring-cyborg bot commented Mar 15, 2024

Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

@potiuk
Copy link
Member

potiuk commented Mar 15, 2024

Next time we see it - in 4 years. Hopefully someone will fix it by then.

@potiuk potiuk added good first issue and removed needs-triage label for new issues that we didn't triage yet labels Mar 15, 2024
@hussein-awala
Copy link
Member

hussein-awala commented Mar 15, 2024

Actually, the issue is not in Airflow, it's an issue in croniter package:

>>> from croniter import croniter
>>> import datetime
>>> croniter("0 0 28 2 *", start_time=datetime.datetime(2024, 1, 1)).get_prev(datetime.datetime)
datetime.datetime(2023, 2, 28, 0, 0)
>>> croniter("0 0 29 2 *", start_time=datetime.datetime(2024, 1, 1)).get_prev(datetime.datetime)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/hussein-awala/anaconda3/envs/airflow/lib/python3.11/site-packages/croniter/croniter.py", line 204, in get_prev
    return self._get_next(ret_type or self._ret_type, is_prev=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hussein-awala/anaconda3/envs/airflow/lib/python3.11/site-packages/croniter/croniter.py", line 289, in _get_next
    result = self._calc(self.cur, expanded,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hussein-awala/anaconda3/envs/airflow/lib/python3.11/site-packages/croniter/croniter.py", line 563, in _calc
    raise CroniterBadDateError("failed to find prev date")
croniter.croniter.CroniterBadDateError: failed to find prev date

Airflow catches the exception and returns None, I will check if it's possible to fix it in cornitor, otherwise we can add a special case for 29 Feb.

@hussein-awala
Copy link
Member

I think it was fixed two weeks ago, I will check: kiorky/croniter@6824882

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants