You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/09/08 23:34:17 UTC

[GitHub] [beam] aaltay commented on a change in pull request #12789: Support updating from a job in DRAINING state

aaltay commented on a change in pull request #12789:
URL: https://github.com/apache/beam/pull/12789#discussion_r485251184



##########
File path: sdks/python/apache_beam/runners/dataflow/internal/apiclient.py
##########
@@ -923,8 +923,9 @@ def job_id_for_name(self, job_name):
           pageToken=token)
       response = self._client.projects_locations_jobs.List(request)
       for job in response.jobs:
-        if (job.name == job_name and job.currentState ==
-            dataflow.Job.CurrentStateValueValuesEnum.JOB_STATE_RUNNING):
+        if (job.name == job_name and job.currentState in

Review comment:
       Could you add a pydoc comment to this function explaining that this is used for updates and it will return a job id only for running/draining pipelines?
   
   Should we change the function name, this seems to be a internal only function?

##########
File path: sdks/python/apache_beam/runners/dataflow/internal/apiclient.py
##########
@@ -923,8 +923,9 @@ def job_id_for_name(self, job_name):
           pageToken=token)
       response = self._client.projects_locations_jobs.List(request)
       for job in response.jobs:
-        if (job.name == job_name and job.currentState ==
-            dataflow.Job.CurrentStateValueValuesEnum.JOB_STATE_RUNNING):
+        if (job.name == job_name and job.currentState in
+            [dataflow.Job.CurrentStateValueValuesEnum.JOB_STATE_RUNNING,
+             dataflow.Job.CurrentStateValueValuesEnum.JOB_STATE_DRAINING]):

Review comment:
       Add a test to apiclient_test so that this behavior is not reverted in the future?




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