Fix: dag next-execution --table crashes when no next run exists (#67394)#67425
Fix: dag next-execution --table crashes when no next run exists (#67394)#67425bramhanandlingala wants to merge 3 commits into
Conversation
…he#67394) The table branch of dag_next_execution applied operator.attrgetter directly on values from iter_next_dagrun_info() without guarding against None. This caused an AttributeError when a DAG has schedule=None or @once exhausts its single run. Mirror the non-table path existing None-guard: skip None values, emit the same stderr warning, and print an empty table. Adds parametrised tests for schedule=None, @once with 1 and 2 executions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
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
|
|
@ashb @XD-DENG @bolkedebruin @jedcunningham @ephraimbuddy |
|
@bramhanandlingala — I've removed the Automated triage note drafted by an AI-assisted tool — may get things wrong; a real Apache Airflow maintainer takes the next look once it's green. (why automated) Drafted-by: Claude Code (Opus 4.8); reviewed by @potiuk before posting |
|
@bramhanandlingala This PR has been converted to draft because it does not yet meet our Pull Request quality criteria. Issues found:
What to do next:
Converting a PR to draft is not a rejection — it is an invitation to bring the PR up to the project's standards so that maintainer review time is spent productively. There is no rush — take your time and work at your own pace. We appreciate your contribution and are happy to wait for updates. If you have questions, feel free to ask on the Airflow Slack. Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this two-stage triage process so that our maintainers' limited time is spent where it matters most: the conversation with you. |
When you run
airflow dags next-execution <dag_id> --table, it crashes with anAttributeErrorif the DAG has no upcoming scheduled run.For example when
schedule=None, or when a@onceDAG has already run and you ask for a second execution with--num-executions 2.The bug is in the
--tablebranch ofdag_next_execution. It used a one-liner list comprehension that calledoperator.attrgetteron every item yielded byiter_next_dagrun_info(). The problem is that iterator can yieldNoneto signal "no more runs", and calling an attribute getter onNoneblows up immediately.The non-table code path right below it already handles this correctly. it checks
if info is None, prints a warning to stderr, and carries on. The table branch just never got the same treatment.This PR fixes it by expanding the list comprehension into a proper loop, adding the same
Nonecheck, and emitting the same warning message.Valid runs are collected into a list and printed as a table as before;
Noneentries are skipped with a warning.Are you willing to submit PR?
Yes, if helpful.
Code of Conduct
I agree to follow this project's Code of Conduct
closes: #67394
Important
🛠️ Maintainer triage note for @bramhanandlingala · by
@potiuk· 2026-07-18 16:36 UTCI've removed the
ready for maintainer reviewlabel — the next step here is yours:main. See docs.It'll return to the maintainer queue automatically once resolved — no need to re-add the label by hand. See the Pull Request quality criteria for details.
The ball is in your court — you've been assigned. Rebase onto
main, push, then mark it Ready for review.Automated triage — may be imperfect; a maintainer takes the next look.