keze commented on a change in pull request #18981:
URL: https://github.com/apache/airflow/pull/18981#discussion_r733817533



##########
File path: airflow/providers/google/cloud/hooks/dataflow.py
##########
@@ -356,18 +356,23 @@ def _fetch_all_jobs(self) -> List[dict]:
             .jobs()
             .list(projectId=self._project_number, location=self._job_location)
         )
-        jobs: List[dict] = []
+        all_jobs: List[dict] = []
         while request is not None:
             response = request.execute(num_retries=self._num_retries)
-            jobs.extend(response["jobs"])
+            if response is None:
+                break
+            jobs = response.get("jobs")
+            if jobs is None:
+                break
+            all_jobs.extend(jobs)

Review comment:
       I wouldn't rely on the code after this line to handle following listing, 
I would rather to clearly exit on absence of "jobs" key, otherwise I like your 
solution better




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