Repository navigation
Fix Teradata compute cluster trigger swallowing task cancellation - #72695
Conversation
5d7e7ea to
7f861e6
Compare
|
cc @sc250072 for Teradata review |
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
a8199ee to
accd8f3
Compare
potiuk
left a comment
There was a problem hiding this comment.
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.pyrun_trigger()handlesCancelledErroraroundasync for event in trigger.run()(timeout → re-raise, user action →on_kill(), shutdown → re-raise), andcleanup_finished_triggers()treats a task that raisedCancelledErroras an expected exit while a task that returned with zero events is failed. Swallowing the exception in the trigger short-circuited both.except Exceptiondoes not catchCancelledError(it is aBaseExceptionon Python >= 3.8; the provider floor is 3.10), so nothing else changes.test_run_propagates_cancelled_errorfails without the fix (the generator finishes normally andpytest.raisesreports 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
mainso 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.
Summary
The triggerer tells a deferral timeout, a user action and its own shutdown apart only by
asyncio.CancelledErrorpropagating out ofrun().TeradataComputeClusterSyncTriggercaught 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 onFailed to SUSPEND the Vantage Cloud Lake Compute Cluster Instance ... Please contact the administrator for assistance., even on a routine triggerer restartWas generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5) following the guidelines