You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/07/29 14:10:29 UTC
[GitHub] [airflow] josh-fell commented on a diff in pull request #25342: Fix BigQueryInsertJobOperator cancel_on_kill
josh-fell commented on code in PR #25342:
URL: https://github.com/apache/airflow/pull/25342#discussion_r933313569
##########
airflow/providers/google/cloud/operators/bigquery.py:
##########
@@ -2221,10 +2217,16 @@ def execute(self, context: Any):
BigQueryTableLink.persist(**persist_kwargs)
self.job_id = job.job_id
- return job.job_id
+ # Wait for the job to complete
+ job.result(timeout=self.result_timeout, retry=self.result_retry)
+ self._handle_job_error(job)
+
+ return self.job_id
def on_kill(self) -> None:
if self.job_id and self.cancel_on_kill:
self.hook.cancel_job( # type: ignore[union-attr]
job_id=self.job_id, project_id=self.project_id, location=self.location
)
+ else:
+ self.log.info(f'Skipping to cancel job: {self.project_id}:{self.location}.{self.job_id}')
Review Comment:
```suggestion
self.log.info('Skipping to cancel job: %s:%s.%s', self.project_id, self.location, self.job_id)
```
We should [try to avoid f-strings in logging statements](https://blog.pilosus.org/posts/2020/01/24/python-f-strings-in-logging/) and use %-format style instead.
--
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