Fix dags next-execution --table crash when no next schedule exists#67417
Open
vincere-mori wants to merge 1 commit into
Open
Fix dags next-execution --table crash when no next schedule exists#67417vincere-mori wants to merge 1 commit into
dags next-execution --table crash when no next schedule exists#67417vincere-mori wants to merge 1 commit into
Conversation
The `--table` path passed all items from `iter_next_dagrun_info()` directly into a list comprehension that calls `operator.attrgetter(c)` on each item. When there is no next scheduled run (schedule=None, or @once after its run, or more executions requested than the schedule provides), the iterator yields `None`. Calling `attrgetter` on `None` raises `AttributeError: 'NoneType' object has no attribute '...'`. The non-table path already handled `None` correctly by printing a warning to stderr and skipping to the next iteration. Apply the same guard to the table path: skip `None` items and print the same warning message. Fixes apache#67394
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
airflow dags next-execution <dag_id> --tablecrashes withAttributeErrorwhen the DAG has no next scheduled run (e.g.schedule=None, or an@onceDAG after its run, or--num-executionsexceeds available runs).The root cause is in the table-output branch:
iter_next_dagrun_info()yieldsDagRunInfo | None. WhenoisNone, callingoperator.attrgetter(c)(None)raisesAttributeError: 'NoneType' object has no attribute 'logical_date'.The non-table path already handles
Nonecorrectly:Reproduce
airflow dags next-execution no_schedule --table # AttributeError: 'NoneType' object has no attribute 'logical_date'Fix
Mirror the non-table
Noneguard in the table path: skipNoneitems and print the same warning to stderr.Fixes #67394