pankajastro commented on code in PR #31872:
URL: https://github.com/apache/airflow/pull/31872#discussion_r1234016911
##########
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:
currently, if this operator will not defer then it will succeed. I was
thinking of the case when `job.state` is not success we are logging that the
job state is not success but still marking task success.
--
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]