Skip to content

[airflow-ctl/v0-1-test] Keep airflowctl dags pause/unpause/drain output parseable (#76133) - #76172

Merged
shahar1 merged 1 commit into
apache:airflow-ctl/v0-1-testfrom
shahar1:ctl016-run3-76133-sonnet
Oct 31, 2026
Merged

shahar1 merged 1 commit into
apache:airflow-ctl/v0-1-testfrom
shahar1:ctl016-run3-76133-sonnet

Conversation

@shahar1

@shahar1 shahar1 commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Manual backport of #76133 to airflow-ctl/v0-1-test for 0.1.6. The automatic backport (run 41203511872) stopped on a conflict in airflow-ctl/tests/airflow_ctl/ctl/commands/test_dag_command.py and opened nothing.

airflowctl dags pause|unpause printed Dag <operation> successful <dag_id> and Further Dag details: to stdout ahead of the --output data, so airflowctl dags pause my_dag -o json | jq . failed: stdout was not valid JSON. The error message on failure went to stdout as well. These lines now go to stderr, as on main; stdout carries only the requested output format. In a terminal the visible output does not change; scripts that captured stdout for these status lines will now find them on stderr (exit code unchanged), which may deserve a line in the 0.1.6 release notes.

Resolution: the source change is identical to main (the +/- lines of dag_command.py match). This branch has no dags drain, so the conflict was only in the test file: the two new tests are kept for pause/unpause, the drain rows of their parametrize lists and the main-only drain tests in the surrounding context were not brought over, and import json was added. Original author kept.

Tested on the branch: uv run --project airflow-ctl pytest airflow-ctl/tests: 607 passed; the four new test cases fail without the source change. The airflow-ctl-tests integration runner merges stderr into stdout, so the dags pause/unpause example_bash_operator integration commands are unaffected.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Fable 5.1, with Sonnet 5.5 and Opus 5.5 subagents)

Generated-by: Claude Code (Fable 5.1) following the guidelines

…ut parseable (apache#76133)

The "Dag <operation> successful" and "Further Dag details:" status lines, and the error message on failure, were printed to stdout ahead of the --output data. That made `airflowctl dags pause <dag_id> -o json` produce output that is not valid JSON, so piping it to jq or json.loads failed. Status and error text belong on stderr, matching how the CLI already reports the ambiguous-write warning, so stdout carries only the requested output format.

Backport note: this branch has no `dags drain`, so the drain cases of the new tests were dropped; the source change is identical to main.

(cherry picked from commit 956d8cd)
@shahar1
shahar1 enabled auto-merge (squash) October 31, 2026 19:41
@shahar1
shahar1 disabled auto-merge October 31, 2026 20:57
@shahar1
shahar1 merged commit 073142e into apache:airflow-ctl/v0-1-test Oct 31, 2026
13 checks passed
shahar1 added a commit that referenced this pull request Nov 19, 2026
…ut parseable (#76133) (#76172)

The "Dag <operation> successful" and "Further Dag details:" status lines, and the error message on failure, were printed to stdout ahead of the --output data. That made `airflowctl dags pause <dag_id> -o json` produce output that is not valid JSON, so piping it to jq or json.loads failed. Status and error text belong on stderr, matching how the CLI already reports the ambiguous-write warning, so stdout carries only the requested output format.

Backport note: this branch has no `dags drain`, so the drain cases of the new tests were dropped; the source change is identical to main.

(cherry picked from commit 956d8cd)

Co-authored-by: Shawn Sun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants