Skip to content

Fix Teradata compute cluster trigger swallowing task cancellation - #72695

Merged
potiuk merged 2 commits into
apache:mainfrom
rjgoyln:fix/teradata-cc-trigger-reraise-cancelled
Sep 20, 2026
Merged

potiuk merged 2 commits into
apache:mainfrom
rjgoyln:fix/teradata-cc-trigger-reraise-cancelled

Conversation

@rjgoyln

@rjgoyln rjgoyln commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The triggerer tells a deferral timeout, a user action and its own shutdown apart only by asyncio.CancelledError propagating out of run(). TeradataComputeClusterSyncTrigger caught it, so every cancellation produced:

  • Trigger exited without sending an event. Dependent tasks will be failed. instead of the deferral timeout the task was waiting on
  • Failed to SUSPEND the Vantage Cloud Lake Compute Cluster Instance ... Please contact the administrator for assistance., even on a routine triggerer restart

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5)

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

@rjgoyln
rjgoyln force-pushed the fix/teradata-cc-trigger-reraise-cancelled branch from 5d7e7ea to 7f861e6 Compare September 8, 2026 12:21
@rjgoyln
rjgoyln marked this pull request as ready for review September 8, 2026 15:34
@eladkal

eladkal commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

cc @sc250072 for Teradata review

rjgoyln and others added 2 commits September 20, 2026 18:31
The triggerer tells a deferral timeout, a user action and its own shutdown
apart only by asyncio.CancelledError propagating out of run(). Catching it
let the trigger task finish normally without an event, so dependent tasks
were failed with a generic message instead of the timeout, and every
cancellation - a routine triggerer restart included - was logged as an
operation failure telling the user to contact their administrator.
Its only user was the removed except asyncio.CancelledError branch in
TeradataComputeClusterSyncTrigger.run().

Generated-by: Claude Opus 5
@potiuk
potiuk force-pushed the fix/teradata-cc-trigger-reraise-cancelled branch from a8199ee to accd8f3 Compare September 20, 2026 16:34

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Removing the except asyncio.CancelledError branch is the right fix: the triggerer's run_trigger() decides timeout vs. user-action vs. shutdown only from CancelledError propagating out of trigger.run(), so catching it here turned every cancellation into a "trigger exited without sending an event" failure plus a spurious "contact the administrator" error log.

Verified against the code:

  • airflow-core/src/airflow/jobs/triggerer_job_runner.py run_trigger() handles CancelledError around async for event in trigger.run() (timeout → re-raise, user action → on_kill(), shutdown → re-raise), and cleanup_finished_triggers() treats a task that raised CancelledError as an expected exit while a task that returned with zero events is failed. Swallowing the exception in the trigger short-circuited both.
  • except Exception does not catch CancelledError (it is a BaseException on Python >= 3.8; the provider floor is 3.10), so nothing else changes.
  • test_run_propagates_cancelled_error fails without the fix (the generator finishes normally and pytest.raises reports DID NOT RAISE) and passes with it; patch.object(..., autospec=True) is used; no existing tests were altered.

Smaller observations

  • One nit inline about the now-unreferenced constant; I pushed a fixup for it and rebased the branch on main so this can merge without another round-trip.

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-docs/05_pull_requests.rst.

@potiuk
potiuk merged commit af1c66d into apache:main Sep 20, 2026
83 checks passed
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.

3 participants