Skip to content

Keep airflowctl stdout parseable when a request is retried or fails - #76347

Merged
shahar1 merged 1 commit into
apache:mainfrom
Andrushika:airflowctl-diagnostics-to-stderr
Nov 3, 2026
Merged

shahar1 merged 1 commit into
apache:mainfrom
Andrushika:airflowctl-diagnostics-to-stderr

Conversation

@Andrushika

Copy link
Copy Markdown
Contributor

Why

The airflowctl API client logs Server error and the retry warning through structlog. airflowctl does not configure structlog, and by default structlog prints to stdout. If the server returns one 503 and then a 200, airflowctl pools list -o json exits 0, but stdout is not valid JSON.

What

main() now sends structlog output to stderr. safe_call_command now prints its error messages to stderr too. This is the same change #76133 and #76134 made for a few commands.

related: #76133, #76134


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Code (Opus 5.5) following the guidelines

The API client logs "Server error" and the tenacity retry warning
through structlog, which prints to stdout when nothing configures it.
A single retried 5xx then puts two log lines in front of the
`-o json` output, while the command still exits 0. The shared error
handler also printed its messages to stdout. apache#76133 and apache#76134 moved
the messages of a few commands to stderr, but these two paths are
shared by every command.
@Andrushika
Andrushika requested a review from henry3260 as a code owner November 3, 2026 05:51
@github-actions github-actions Bot added the fork ci required Gated by AIP-120: CI must pass in the contributor's fork. Managed by the fork CI reconciler. label Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Fork CI: green. CI for the latest commit passed in your fork. The pull request is ready for maintainer review.

Pull requests from contributors run their CI in the contributor's own fork. GitHub Actions is free and has no minute limit on public forks, while the CI capacity of the Apache Software Foundation is shared by every ASF project and is finite.

Latest run: https://github.com/Andrushika/airflow/actions/runs/41585790629

How this works: fork CI for external contributors.


This comment was posted automatically by the fork CI monitor from templates drafted with an AI-assisted tool, so it may contain mistakes. An Apache Airflow maintainer, a real person, will review the pull request once its fork CI is green. Why the first pass is automated.

@github-actions github-actions Bot added the ready for maintainer review Set by triage when all criteria pass, or by the fork CI reconciler when fork CI is green. label Nov 3, 2026

@shahar1 shahar1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Moving the structlog output and the safe_call_command errors to stderr keeps -o json stdout parseable after a retried or failed request; the change is small, matches #76133 / #76134, and the new tests fail without it.

Smaller observations

  • See inline comments on airflow-ctl/src/airflowctl/__main__.py:35.

This review was drafted by an AI-assisted tool and
confirmed by an Apache Airflow maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.

More on how Apache Airflow handles maintainer review:
Contributing guide.

Comment thread airflow-ctl/src/airflowctl/__main__.py Resolved
@shahar1
shahar1 merged commit 6f7cb34 into apache:main Nov 3, 2026
82 checks passed
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Backport successfully created: airflow-ctl/v0-1-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
✅ airflow-ctl/v0-1-test PR Link

shahar1 pushed a commit that referenced this pull request Nov 3, 2026
…st is retried or fails (#76347) (#76380)

The API client logs "Server error" and the tenacity retry warning
through structlog, which prints to stdout when nothing configures it.
A single retried 5xx then puts two log lines in front of the
`-o json` output, while the command still exits 0. The shared error
handler also printed its messages to stdout. #76133 and #76134 moved
the messages of a few commands to stderr, but these two paths are
shared by every command.
(cherry picked from commit 6f7cb34)

Co-authored-by: Andrew Chang <[email protected]>
shahar1 pushed a commit to shahar1/airflow that referenced this pull request Nov 4, 2026
…st is retried or fails (apache#76347) (apache#76380)

The API client logs "Server error" and the tenacity retry warning
through structlog, which prints to stdout when nothing configures it.
A single retried 5xx then puts two log lines in front of the
`-o json` output, while the command still exits 0. The shared error
handler also printed its messages to stdout. apache#76133 and apache#76134 moved
the messages of a few commands to stderr, but these two paths are
shared by every command.
(cherry picked from commit 6f7cb34)

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

Labels

area:airflow-ctl backport-to-airflow-ctl/v0-1-test fork ci required Gated by AIP-120: CI must pass in the contributor's fork. Managed by the fork CI reconciler. ready for maintainer review Set by triage when all criteria pass, or by the fork CI reconciler when fork CI is green.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants