Skip to content

Remove no-op ServerResponseError re-raise blocks in airflowctl operations - #70376

Merged
henry3260 merged 4 commits into
apache:mainfrom
astronomer:cleanup-airflowctl-redundant-reraise
Jul 26, 2026
Merged

Remove no-op ServerResponseError re-raise blocks in airflowctl operations#70376
henry3260 merged 4 commits into
apache:mainfrom
astronomer:cleanup-airflowctl-redundant-reraise

Conversation

@Lee-W

@Lee-W Lee-W commented Jul 24, 2026

Copy link
Copy Markdown
Member

Why

Every operation wrapped its request in a try/except that caught ServerResponseError only to re-raise it unchanged. The error is already raised by the client's raise_on_4xx_5xx response hook, so these wrappers added no behavior and only obscured the request logic.
During reviewing #69397, I found out we have lots of such usage.

What

Dropping them leaves the propagation semantics identical while making each operation a plain request/parse.


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

Generated-by: [Claude] following the guidelines


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

…ions

Every operation wrapped its request in a try/except that caught
ServerResponseError only to re-raise it unchanged. The error is already
raised by the client's raise_on_4xx_5xx response hook, so these wrappers
added no behavior and only obscured the request logic. Dropping them
leaves the propagation semantics identical while making each operation a
plain request/parse.

@henry3260 henry3260 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.

LGTM, I left a few suggestions to make the ‎Dag wording consistent

Comment thread airflow-ctl/src/airflowctl/api/operations.py Outdated
Comment thread airflow-ctl/src/airflowctl/api/operations.py Outdated
Comment thread airflow-ctl/src/airflowctl/api/operations.py Outdated
@henry3260

Copy link
Copy Markdown
Contributor

I think there might be a couple of pre-existing endpoint bugs here (unrelated to this PR’s cleanup, but worth flagging while we’re looking):

  • delete_dag_queued_events calls ‎assets/dags/{dag_id}/queuedEvents, but based on the corresponding ‎get_dag_queued_events it should be ‎dags/{dag_id}/assets/queuedEvents.

  • delete_queued_event calls ‎assets/dags/{dag_id}/assets/{asset_id}/queuedEvents/, but it should be ‎dags/{dag_id}/assets/{asset_id}/queuedEvents.

Lee-W and others added 3 commits July 26, 2026 11:04
Co-authored-by: Henry Chen <henryhenry0512@gmail.com>
Co-authored-by: Henry Chen <henryhenry0512@gmail.com>
Co-authored-by: Henry Chen <henryhenry0512@gmail.com>
@Lee-W

Lee-W commented Jul 26, 2026

Copy link
Copy Markdown
Member Author

I think there might be a couple of pre-existing endpoint bugs here (unrelated to this PR’s cleanup, but worth flagging while we’re looking):

* ‎`delete_dag_queued_events` calls ‎`assets/dags/{dag_id}/queuedEvents`, but based on the corresponding ‎`get_dag_queued_events` it should be ‎`dags/{dag_id}/assets/queuedEvents`.

* ‎`delete_queued_event` calls ‎`assets/dags/{dag_id}/assets/{asset_id}/queuedEvents/`, but it should be ‎`dags/{dag_id}/assets/{asset_id}/queuedEvents`.

Hmmm... indeed. but i guess it's not a good idea to change it now either 🤔

@henry3260
henry3260 merged commit fba10d4 into apache:main Jul 26, 2026
97 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Backport failed to create: airflow-ctl/v0-1-test. View the failure log Run details

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 Commit Link

You can attempt to backport this manually by running:

cherry_picker fba10d4 airflow-ctl/v0-1-test

This should apply the commit to the airflow-ctl/v0-1-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

If you don't have cherry-picker installed, see the installation guide.

@henry3260

Copy link
Copy Markdown
Contributor

backport in #70460

Kunal8954 pushed a commit to Kunal8954/airflow that referenced this pull request Jul 27, 2026
…ions (apache#70376)

* Remove no-op ServerResponseError re-raise blocks in airflowctl operations

Every operation wrapped its request in a try/except that caught
ServerResponseError only to re-raise it unchanged. The error is already
raised by the client's raise_on_4xx_5xx response hook, so these wrappers
added no behavior and only obscured the request logic. Dropping them
leaves the propagation semantics identical while making each operation a
plain request/parse.

* Update airflow-ctl/src/airflowctl/api/operations.py

Co-authored-by: Henry Chen <henryhenry0512@gmail.com>

* Update airflow-ctl/src/airflowctl/api/operations.py

Co-authored-by: Henry Chen <henryhenry0512@gmail.com>

* Update airflow-ctl/src/airflowctl/api/operations.py

Co-authored-by: Henry Chen <henryhenry0512@gmail.com>

---------

Co-authored-by: Henry Chen <henryhenry0512@gmail.com>
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.

4 participants