pankajkoti commented on code in PR #31249:
URL: https://github.com/apache/airflow/pull/31249#discussion_r1198565718
##########
airflow/providers/google/cloud/operators/bigquery.py:
##########
@@ -2698,16 +2698,19 @@ def execute(self, context: Any):
self._handle_job_error(job)
return self.job_id
- self.defer(
- timeout=self.execution_timeout,
- trigger=BigQueryInsertJobTrigger(
- conn_id=self.gcp_conn_id,
- job_id=self.job_id,
- project_id=self.project_id,
- poll_interval=self.poll_interval,
- ),
- method_name="execute_complete",
- )
+ else:
+ if job.running():
+ self.defer(
+ timeout=self.execution_timeout,
+ trigger=BigQueryInsertJobTrigger(
+ conn_id=self.gcp_conn_id,
+ job_id=self.job_id,
+ project_id=self.project_id,
+ poll_interval=self.poll_interval,
+ ),
+ method_name="execute_complete",
+ )
+ self.log.info("Current state of job %s is %s", job.job_id,
job.state)
Review Comment:
I think it's nice to capture and assert this log in the test too.
--
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]