You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/10/21 18:43:18 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #11726: Add DataflowJobStatusSensor

mik-laj commented on a change in pull request #11726:
URL: https://github.com/apache/airflow/pull/11726#discussion_r509568774



##########
File path: airflow/providers/google/cloud/hooks/dataflow.py
##########
@@ -905,3 +910,30 @@ def cancel_job(
             poll_sleep=self.poll_sleep,
         )
         jobs_controller.cancel()
+
+    @GoogleBaseHook.fallback_to_default_project_id
+    def get_job(
+        self,
+        job_id: str,
+        project_id: str,
+        location: str = DEFAULT_DATAFLOW_LOCATION,
+    ) -> dict:
+        """
+        Gets the job with the specified Job ID.
+
+        :param job_id: Job ID to get.
+        :type job_id: str
+        :param project_id: Optional, the Google Cloud project ID in which to start a job.
+            If set to None or missing, the default project_id from the Google Cloud connection is used.
+        :type project_id:
+        :param location: Job location.
+        :type location: str
+        :return: the Job
+        :rtype: dict
+        """
+        jobs_controller = _DataflowJobsController(
+            dataflow=self.get_conn(),
+            project_number=project_id,
+            location=location,
+        )
+        return jobs_controller._fetch_job_by_id(job_id)  # pylint: disable=protected-access

Review comment:
       ```suggestion
           return jobs_controller.fetch_job_by_id(job_id)  # pylint: disable=protected-access
   ```
   This method should be marked public because it is used by an external class.




----------------------------------------------------------------
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:
users@infra.apache.org