aaltay commented on a change in pull request #8550:
URL: https://github.com/apache/airflow/pull/8550#discussion_r501903701
##########
File path: airflow/providers/google/cloud/hooks/dataflow.py
##########
@@ -282,41 +295,70 @@ def wait_for_done(self) -> None:
time.sleep(self._poll_sleep)
self._refresh_jobs()
- def get_jobs(self) -> List[Dict]:
+ def get_jobs(self, refresh=False) -> List[Dict]:
"""
Returns Dataflow jobs.
:return: list of jobs
:rtype: list
"""
- if not self._jobs:
+ if not self._jobs or refresh:
self._refresh_jobs()
if not self._jobs:
raise ValueError("Could not read _jobs")
return self._jobs
+ def _wait_for_states(self, expected_states: Set[str]):
+ """
+ Waiting for the jobs to reach a certain state.
+ """
+ if not self._jobs:
+ raise ValueError("The _jobs should be set")
+ while True:
Review comment:
I think this is reasonable.
Side note, cancel usually completes quickly. On the other hand drain is the
safer way to cancel streaming pipelines and that can take a long time depending
on the state of the pipeline.
----------------------------------------------------------------
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]