turbaszek commented on a change in pull request #10673:
URL: https://github.com/apache/airflow/pull/10673#discussion_r481055395
##########
File path: airflow/providers/google/cloud/operators/dataproc.py
##########
@@ -1834,8 +1846,16 @@ def execute(self, context: Dict):
)
job_id = job_object.reference.job_id
self.log.info("Waiting for job %s to complete", job_id)
- hook.wait_for_job(job_id=job_id, project_id=self.project_id,
location=self.location)
- self.log.info("Job completed successfully.")
+ if not self.asynchronous:
+ hook.wait_for_job(
+ job_id=job_id,
+ project_id=self.project_id,
+ location=self.location
+ )
+ self.log.info("Job completed successfully.")
+ else:
+ self.log.info("Job submitted successfully.")
+ return job_id
Review comment:
```suggestion
self.log.info("Job submitted successfully.")
if not self.asynchronous:
self.log.info("Waiting for the job to complete...")
hook.wait_for_job(
job_id=job_id,
project_id=self.project_id,
location=self.location
)
return job_id
```
`hook.wait_for_job` is blocking operation so this should do and it's
simpler, WDYT?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]