Skip to content

edge3: Exit non-zero when worker admin CLI commands fail#70112

Open
dkranchii wants to merge 1 commit into
apache:mainfrom
dkranchii:fix-edge3-worker-admin-exit-codes
Open

edge3: Exit non-zero when worker admin CLI commands fail#70112
dkranchii wants to merge 1 commit into
apache:mainfrom
dkranchii:fix-edge3-worker-admin-exit-codes

Conversation

@dkranchii

Copy link
Copy Markdown
Contributor

add-worker-queues, remove-worker-queues, and set-worker-concurrency raised bare SystemExit after catching a TypeError from the model layer (raised when the target worker is in OFFLINE, OFFLINE_MAINTENANCE, or UNKNOWN state). SystemExit() with no argument yields exit code 0, so shell scripts wrapping these commands saw success and continued as if the queue or concurrency change had been applied, when in fact it had been silently rejected.

Pass the exception message to SystemExit(str(e)) so the process exits with status 1 and writes the failure to stderr. Matches this file's own convention for validation-error paths (e.g. raise SystemExit("Error: No queues specified to add.") a few lines above each fix site) and the raise SystemExit(str(e)) pattern already used in providers/edge3/src/airflow/providers/edge3/cli/worker.py.

The model layer at providers/edge3/src/airflow/providers/edge3/models/edge_worker.py already calls logger.error(error_message) before raising, so the CLI-side logger.error(str(e)) was strictly duplicative and is removed.

Adds parametrized tests over all three subcommands asserting that SystemExit.code carries the error message (i.e. exit status is 1, not 0).


Was generative AI tooling used to co-author this PR?
  • Yes — Cursor

The add-worker-queues, remove-worker-queues, and set-worker-concurrency
subcommands raised bare `SystemExit` after catching a TypeError from the
model layer, which yields exit status 0. Shell scripts wrapping these
commands treated failures as success and continued as if the queue or
concurrency change had been applied.

Pass the exception message to SystemExit so the process exits with
status 1 and writes the failure to stderr, matching the file's own
convention for validation-error paths (see the explicit
`raise SystemExit("Error: ...")` calls in the same subcommands) and the
`raise SystemExit(str(e))` pattern already used elsewhere in the edge3
CLI. The model layer already logs the error before raising, so the
redundant logger.error call is removed.
@boring-cyborg boring-cyborg Bot added area:providers provider:edge Edge Executor / Worker (AIP-69) / edge3 labels Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:edge Edge Executor / Worker (AIP-69) / edge3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant