ephraimbuddy commented on code in PR #39442:
URL: https://github.com/apache/airflow/pull/39442#discussion_r1592202019
##########
airflow/providers/google/cloud/triggers/bigquery.py:
##########
@@ -118,7 +132,8 @@ async def run(self) -> AsyncIterator[TriggerEvent]: #
type: ignore[override]
await asyncio.sleep(self.poll_interval)
except asyncio.CancelledError:
self.log.info("Task was killed.")
- if self.job_id and self.cancel_on_kill:
+ if self.job_id and self.cancel_on_kill and self.safe_to_cancel():
Review Comment:
```suggestion
if self.job_id and self.cancel_on_kill and
self.task_instance.state not in {
TaskInstanceState.RUNNING,
TaskInstanceState.DEFERRED,
}:
```
I feel you don't need the extra function if you only want to check if the
state is in the above states. safe_to_cancel gives the impression that there's
a lot you're checking.
Also, check if it should be `TaskInstanceState.unfinished`
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]