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 2018/08/20 23:55:46 UTC

[GitHub] kaxil closed pull request #3755: [AIRFLOW-2905] Fix get job API endpoint

kaxil closed pull request #3755: [AIRFLOW-2905] Fix get job API endpoint
URL: https://github.com/apache/incubator-airflow/pull/3755
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/contrib/hooks/gcp_dataflow_hook.py b/airflow/contrib/hooks/gcp_dataflow_hook.py
index 3a8eb28cee..8c9b7423e0 100644
--- a/airflow/contrib/hooks/gcp_dataflow_hook.py
+++ b/airflow/contrib/hooks/gcp_dataflow_hook.py
@@ -57,10 +57,10 @@ def _get_job_id_from_name(self):
 
     def _get_job(self):
         if self._job_id:
-            job = self._dataflow.projects().jobs().get(
+            job = self._dataflow.projects().locations().jobs().get(
                 projectId=self._project_number,
-                jobId=self._job_id
-            ).execute(num_retries=5)
+                location=self._job_location,
+                jobId=self._job_id).execute(num_retries=5)
         elif self._job_name:
             job = self._get_job_id_from_name()
         else:
diff --git a/tests/contrib/hooks/test_gcp_dataflow_hook.py b/tests/contrib/hooks/test_gcp_dataflow_hook.py
index 686db10e5c..7811e4aabd 100644
--- a/tests/contrib/hooks/test_gcp_dataflow_hook.py
+++ b/tests/contrib/hooks/test_gcp_dataflow_hook.py
@@ -267,11 +267,12 @@ def setUp(self):
 
     def test_dataflow_job_init_with_job_id(self):
         mock_jobs = MagicMock()
-        self.mock_dataflow.projects.return_value.\
+        self.mock_dataflow.projects.return_value.locations.return_value.\
             jobs.return_value = mock_jobs
         _DataflowJob(self.mock_dataflow, TEST_PROJECT, TEST_JOB_NAME,
                      TEST_LOCATION, 10, TEST_JOB_ID)
-        mock_jobs.get.assert_called_with(projectId=TEST_PROJECT, jobId=TEST_JOB_ID)
+        mock_jobs.get.assert_called_with(projectId=TEST_PROJECT, location=TEST_LOCATION,
+                                         jobId=TEST_JOB_ID)
 
     def test_dataflow_job_init_without_job_id(self):
         mock_jobs = MagicMock()


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services