This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new af1c66d7426 Fix Teradata compute cluster trigger swallowing task
cancellation (#72695)
af1c66d7426 is described below
commit af1c66d74263db1074ced3f382eac73461b12b6c
Author: rjgoyln <[email protected]>
AuthorDate: Mon Sep 21 01:51:08 2026 +0800
Fix Teradata compute cluster trigger swallowing task cancellation (#72695)
* Fix Teradata compute cluster trigger swallowing task cancellation
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.
* Drop the now-unreferenced CC_OPR_TIMEOUT_ERROR constant
Its only user was the removed except asyncio.CancelledError branch in
TeradataComputeClusterSyncTrigger.run().
Generated-by: Claude Opus 5
---------
Co-authored-by: Jarek Potiuk <[email protected]>
---
.../teradata/triggers/teradata_compute_cluster.py | 2 --
.../src/airflow/providers/teradata/utils/constants.py | 1 -
.../teradata/triggers/test_teradata_compute_cluster.py | 16 ++++++++++++++++
3 files changed, 16 insertions(+), 3 deletions(-)
diff --git
a/providers/teradata/src/airflow/providers/teradata/triggers/teradata_compute_cluster.py
b/providers/teradata/src/airflow/providers/teradata/triggers/teradata_compute_cluster.py
index 9b31997bbc8..462628f3141 100644
---
a/providers/teradata/src/airflow/providers/teradata/triggers/teradata_compute_cluster.py
+++
b/providers/teradata/src/airflow/providers/teradata/triggers/teradata_compute_cluster.py
@@ -96,8 +96,6 @@ class TeradataComputeClusterSyncTrigger(BaseTrigger):
)
except Exception as e:
yield TriggerEvent({"status": "error", "message": str(e)})
- except asyncio.CancelledError:
- self.log.error(Constants.CC_OPR_TIMEOUT_ERROR,
self.operation_type, self.compute_profile_name)
async def get_status(self) -> str:
"""Return compute cluster SUSPEND/RESUME operation status."""
diff --git
a/providers/teradata/src/airflow/providers/teradata/utils/constants.py
b/providers/teradata/src/airflow/providers/teradata/utils/constants.py
index 37edf8a6116..c929e2304d9 100644
--- a/providers/teradata/src/airflow/providers/teradata/utils/constants.py
+++ b/providers/teradata/src/airflow/providers/teradata/utils/constants.py
@@ -32,7 +32,6 @@ class Constants:
CC_OPR_EMPTY_PROFILE_ERROR_MSG = "Failed to %s the Vantage Cloud Lake
Compute Cluster Instance due to an invalid compute cluster profile name."
CC_GRP_PRP_NON_EXISTS_MSG = "Failed to %s the Vantage Cloud Lake Compute
Cluster Instance because the specified compute cluster does not exist or the
user lacks the necessary permissions to access the Compute Cluster Instance."
CC_GRP_LAKE_SUPPORT_ONLY_MSG = "Failed to %s the Vantage Cloud Lake
Compute Cluster Instance because the Compute Cluster feature is supported only
on the Vantage Cloud Lake system."
- CC_OPR_TIMEOUT_ERROR = "Failed to %s the Vantage Cloud Lake Compute
Cluster Instance `%s`. Please contact the administrator for assistance."
CC_ERR_VERSION_GET = "Failed to manage the Vantage Cloud Lake Compute
Cluster Instance due to an error while getting the Teradata database version."
BTEQ_REMOTE_ERROR_MSG = (
"Failed to establish a SSH connection to the remote machine for
executing the BTEQ script."
diff --git
a/providers/teradata/tests/unit/teradata/triggers/test_teradata_compute_cluster.py
b/providers/teradata/tests/unit/teradata/triggers/test_teradata_compute_cluster.py
index ee454e5c4eb..3b3a9d71206 100644
---
a/providers/teradata/tests/unit/teradata/triggers/test_teradata_compute_cluster.py
+++
b/providers/teradata/tests/unit/teradata/triggers/test_teradata_compute_cluster.py
@@ -17,6 +17,7 @@
# under the License.
from __future__ import annotations
+import asyncio
from unittest.mock import call, patch
import pytest
@@ -219,3 +220,18 @@ async def test_get_status_cg(mock_teradata_hook_run):
),
]
)
+
+
[email protected]
+async def test_run_propagates_cancelled_error():
+ trigger = TeradataComputeClusterSyncTrigger(
+ teradata_conn_id="test_conn_id",
+ compute_profile_name="test_profile",
+ operation_type=Constants.CC_SUSPEND_OPR,
+ poll_interval=1,
+ )
+ with patch.object(trigger, "get_status", autospec=True) as mock_get_status:
+ mock_get_status.side_effect = asyncio.CancelledError
+ with pytest.raises(asyncio.CancelledError):
+ async for _ in trigger.run():
+ pass