Repository navigation
[v3-3-test] Fix DAG.cli() crashing on dags pause and unpause (#72109) - #72565
Merged
Merged
Conversation
* Fix DAG.cli() crashing on dags pause and unpause A Dag file run as a script goes through DAG.cli(), whose parser drops --dag-id and instead dispatches every subcommand with the Dag object as a second positional argument. The pause and unpause handlers never accepted it, so Dag authors got a TypeError instead of the command. The handlers are only reachable this way from a Dag file, which is why the regular `airflow dags pause` path has always worked and no test covered the difference. * Ignore --treat-dag-id-as-regex when DAG.cli() supplies the Dag The Dag-scoped parser drops --dag-id but keeps --treat-dag-id-as-regex, so the flag survives into a context where the user has no pattern left to supply. The Dag's own id was then read back as a pattern, and dag_ids may contain dots, so an unanchored match could pause unrelated Dags. Normalising the flag next to the dag_id it guards covers both of its readers, including the confirmation prompt, rather than guarding each reader in turn and leaving the next one to be found later. * Update airflow-core/tests/unit/cli/commands/test_dag_command.py --------- (cherry picked from commit bcc430f) Co-authored-by: Y-C <easoneason0905@gmail.com> Co-authored-by: Eason09053360 <185830721+Eason09053360@users.noreply.github.com> Co-authored-by: Henry Chen <henryhenry0512@gmail.com>
1 task done
henry3260
marked this pull request as ready for review
September 5, 2026 16:22
henry3260
requested review from
bugraoz93,
dheerajturaga,
henry3260 and
potiuk
as code owners
September 5, 2026 16:22
henry3260
approved these changes
Sep 5, 2026
Contributor
Author
|
Hi maintainer, this PR was merged without a milestone set.
|
vatsrahul1001
pushed a commit
that referenced
this pull request
Sep 7, 2026
…#72565) * Fix DAG.cli() crashing on dags pause and unpause A Dag file run as a script goes through DAG.cli(), whose parser drops --dag-id and instead dispatches every subcommand with the Dag object as a second positional argument. The pause and unpause handlers never accepted it, so Dag authors got a TypeError instead of the command. The handlers are only reachable this way from a Dag file, which is why the regular `airflow dags pause` path has always worked and no test covered the difference. * Ignore --treat-dag-id-as-regex when DAG.cli() supplies the Dag The Dag-scoped parser drops --dag-id but keeps --treat-dag-id-as-regex, so the flag survives into a context where the user has no pattern left to supply. The Dag's own id was then read back as a pattern, and dag_ids may contain dots, so an unanchored match could pause unrelated Dags. Normalising the flag next to the dag_id it guards covers both of its readers, including the confirmation prompt, rather than guarding each reader in turn and leaving the next one to be found later. * Update airflow-core/tests/unit/cli/commands/test_dag_command.py --------- (cherry picked from commit bcc430f) Co-authored-by: Y-C <easoneason0905@gmail.com> Co-authored-by: Eason09053360 <185830721+Eason09053360@users.noreply.github.com> Co-authored-by: Henry Chen <henryhenry0512@gmail.com>
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.
A Dag file run as a script goes through DAG.cli(), whose parser drops
--dag-id and instead dispatches every subcommand with the Dag object as
a second positional argument. The pause and unpause handlers never
accepted it, so Dag authors got a TypeError instead of the command.
The handlers are only reachable this way from a Dag file, which is why
the regular
airflow dags pausepath has always worked and no testcovered the difference.
The Dag-scoped parser drops --dag-id but keeps --treat-dag-id-as-regex,
so the flag survives into a context where the user has no pattern left
to supply. The Dag's own id was then read back as a pattern, and dag_ids
may contain dots, so an unanchored match could pause unrelated Dags.
Normalising the flag next to the dag_id it guards covers both of its
readers, including the confirmation prompt, rather than guarding each
reader in turn and leaving the next one to be found later.
(cherry picked from commit bcc430f)
Co-authored-by: Y-C easoneason0905@gmail.com
Co-authored-by: Eason09053360 185830721+Eason09053360@users.noreply.github.com
Co-authored-by: Henry Chen henryhenry0512@gmail.com