uranusjr commented on code in PR #31872:
URL: https://github.com/apache/airflow/pull/31872#discussion_r1228520682
##########
airflow/providers/google/cloud/operators/bigquery.py:
##########
@@ -364,19 +364,21 @@ def execute(self, context: Context) -> None: # type:
ignore[override]
job = self._submit_job(hook, job_id="")
context["ti"].xcom_push(key="job_id", value=job.job_id)
- self.defer(
- timeout=self.execution_timeout,
- trigger=BigQueryValueCheckTrigger(
- conn_id=self.gcp_conn_id,
- job_id=job.job_id,
- project_id=hook.project_id,
- sql=self.sql,
- pass_value=self.pass_value,
- tolerance=self.tol,
- poll_interval=self.poll_interval,
- ),
- method_name="execute_complete",
- )
+ if job.running():
+ self.defer(
+ timeout=self.execution_timeout,
+ trigger=BigQueryValueCheckTrigger(
+ conn_id=self.gcp_conn_id,
+ job_id=job.job_id,
+ project_id=hook.project_id,
+ sql=self.sql,
+ pass_value=self.pass_value,
+ tolerance=self.tol,
+ 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:
This will only be logged if the job ended before the if block, since `defer`
ends the execution immediately. Is this intended?
--
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]