This is an automated email from the ASF dual-hosted git repository.

shahar1 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 9b5fa36ef7a Fix BigQueryInsertJobTrigger not propagating 
CancelledError (#63730)
9b5fa36ef7a is described below

commit 9b5fa36ef7a992cf25ec4f55289ce93efde2049a
Author: Evgeniy Belyaev <[email protected]>
AuthorDate: Tue May 5 18:29:44 2026 +0200

    Fix BigQueryInsertJobTrigger not propagating CancelledError (#63730)
    
    The `except asyncio.CancelledError` block in 
`BigQueryInsertJobTrigger.run()`
    caught the exception for cleanup but never re-raised it, causing the
    cancellation to be silently dropped. The triggerer framework never knew
    the trigger was cancelled.
    
    Added `raise` after cleanup to propagate the error. Updated tests to
    assert the exception is raised.
---
 .../src/airflow/providers/google/cloud/triggers/bigquery.py       | 1 +
 .../google/tests/unit/google/cloud/triggers/test_bigquery.py      | 8 ++------
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git 
a/providers/google/src/airflow/providers/google/cloud/triggers/bigquery.py 
b/providers/google/src/airflow/providers/google/cloud/triggers/bigquery.py
index 70419e5b08d..1eba05425b1 100644
--- a/providers/google/src/airflow/providers/google/cloud/triggers/bigquery.py
+++ b/providers/google/src/airflow/providers/google/cloud/triggers/bigquery.py
@@ -215,6 +215,7 @@ class BigQueryInsertJobTrigger(BaseTrigger):
                     self.location,
                     self.job_id,
                 )
+            raise
         except Exception as e:
             self.log.exception("Exception occurred while checking for query 
completion")
             yield TriggerEvent({"status": "error", "message": str(e)})
diff --git a/providers/google/tests/unit/google/cloud/triggers/test_bigquery.py 
b/providers/google/tests/unit/google/cloud/triggers/test_bigquery.py
index 22f4a17cf54..7b06ae83196 100644
--- a/providers/google/tests/unit/google/cloud/triggers/test_bigquery.py
+++ b/providers/google/tests/unit/google/cloud/triggers/test_bigquery.py
@@ -258,11 +258,9 @@ class TestBigQueryInsertJobTrigger:
 
         caplog.set_level(logging.INFO)
 
-        try:
+        with pytest.raises(asyncio.CancelledError):
             async for _ in insert_job_trigger.run():
                 pass
-        except asyncio.CancelledError:
-            pass
 
         assert (
             "Task was killed" in caplog.text
@@ -294,11 +292,9 @@ class TestBigQueryInsertJobTrigger:
 
         caplog.set_level(logging.INFO)
 
-        try:
+        with pytest.raises(asyncio.CancelledError):
             async for _ in insert_job_trigger.run():
                 pass
-        except asyncio.CancelledError:
-            pass
 
         assert "Skipping to cancel job" in caplog.text, (
             "Expected message about skipping cancellation not found in log."

Reply via email to