ashokballolli commented on code in PR #77069:
URL: https://github.com/apache/airflow/pull/77069#discussion_r4619332884


##########
providers/google/src/airflow/providers/google/cloud/hooks/dataflow.py:
##########
@@ -460,13 +461,33 @@ def fetch_job_id(self) -> str | None:
             self.log.info("Google Cloud DataFlow job not available yet..")
         return self._job_id
 
-    def _fetch_all_jobs(self, jobs_filter: str | None = None) -> list[dict]:
+    def fetch_latest_job_by_name(self, job_name: str) -> dict | None:
+        """
+        Return the latest created job with the given name, in any state.
+
+        Dataflow API does not support getting a single job by name, so the 
jobs in the location
+        are listed with the name passed to the list request.
+
+        :param job_name: Name of the job. It is converted to lowercase because 
Dataflow job names
+            are always lowercase.
+        :return: The job, or None if no job has this name.
+        """
+        job_name = job_name.lower()
+        return max(
+            (job for job in self._fetch_all_jobs(name=job_name) if 
job.get("name") == job_name),

Review Comment:
   You are right, it is not needed. My mistake, I kept it because I was not 
sure if the API matches the exact name. I checked it now and it matches only 
the exact name, so I removed the check and pushed the change.



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