Skip to content

Skip NoneType start/end times when computing data interval for events #50217

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

Open
wants to merge 1 commit into
base: v2-10-stable
Choose a base branch
from

Conversation

headincl0ud
Copy link

Apache Airflow version
2.10.2 (GCP Composer v2)

What happened?
During DAG execution, especially under out-of-capacity conditions, the start_date and end_date fields may be missing. This causes the Airflow Scheduler on GCP to fail during recovery, resulting in the following error:

File ".../airflow/timetables/simple.py, ... in data_interval_for_events"
"TypeError: '<' not supported between instances of 'datetime.datetime' and 'NoneType'"

What you think should happen instead?
The function should validate the presence of both start_date and end_date before attempting to compute the minimum and maximum timestamps. Missing values should be skipped to prevent scheduler crashes.

How to reproduce:
Create a DAG run entry in the Airflow metadata database with a NULL (empty) start_date or end_date. When this DAG run is processed, the scheduler will raise a TypeError.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

Fix: Skip NoneType start/end timestamps in data_interval_for_events to avoid errors when source_dag_run is partially populated
@headincl0ud headincl0ud requested a review from uranusjr as a code owner May 5, 2025 17:34
Copy link
Member

@uranusjr uranusjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Does this not apply for main?

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

Successfully merging this pull request may close these issues.

2 participants