phanikumv commented on code in PR #31317:
URL: https://github.com/apache/airflow/pull/31317#discussion_r1214123578


##########
airflow/providers/google/cloud/operators/dataproc.py:
##########
@@ -2029,6 +2029,16 @@ def execute(self, context: Context):
         )
 
         self.job_id = new_job_id
+
+        job = self.hook.get_job(project_id=self.project_id, 
region=self.region, job_id=self.job_id)
+        state = job.status.state
+        if state == JobStatus.State.DONE:
+            return self.job_id
+        elif state == JobStatus.State.ERROR:
+            raise AirflowException(f"Job failed:\n{job}")
+        elif state == JobStatus.State.CANCELLED:
+            raise AirflowException(f"Job was cancelled:\n{job}")
+

Review Comment:
   moved the code under `self.deferrable` condition



-- 
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]

Reply via email to