You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "kir-rin (via GitHub)" <gi...@apache.org> on 2026/05/11 09:04:58 UTC
[PR] Migrate BigQueryInsertJobTrigger to use on_kill() for user-initiated kills [airflow]
kir-rin opened a new pull request, #66704:
URL: https://github.com/apache/airflow/pull/66704
## What
Migrates `BigQueryInsertJobTrigger` from the `asyncio.CancelledError + safe_to_cancel()` cancellation pattern to the `BaseTrigger.on_kill()` hook introduced in #65590, as tracked in #65733.
- Added `on_kill()` that cancels the BigQuery job via `await hook.cancel_job()`
- Kept backward-compat helpers under `if not AIRFLOW_V_3_3_PLUS:` guards
- Since `BigQueryInsertJobTrigger` is a base class, 4 inheriting triggers get `on_kill()` automatically
- Added focused `on_kill` tests; preserved CancelledError tests under `skipif` guards
## Why
The old `CancelledError + safe_to_cancel()` pattern requires a task-instance state query (DB or RuntimeTaskInstance API) on every trigger cancellation to distinguish user-initiated kills from triggerer restarts/rolling deploys. This adds unnecessary DB access and can incorrectly cancel jobs during infrastructure events.
`on_kill()` makes this distinction at the framework level — it fires only on explicit user kills — eliminating the DB query and ensuring external jobs survive triggerer restarts.
### Why `await` instead of `sync_to_async`?
BigQuery's `cancel_job()` is already an async method, so no `sync_to_async` wrapper is needed (unlike Dataproc/Databricks which use synchronous hooks).
## Manual E2E Test
TODO
related: #65733
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — opencode (GLM-5.1)
Generated-by: opencode (GLM-5.1) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate BigQueryInsertJobTrigger to use on_kill() for user-initiated kills [airflow]
Posted by "shahar1 (via GitHub)" <gi...@apache.org>.
shahar1 merged PR #66704:
URL: https://github.com/apache/airflow/pull/66704
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org