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 2022/06/03 23:18:11 UTC

[GitHub] [beam] robertwb opened a new pull request, #19266: Add an option to run Python operations in-line when invoked as a remote runner.

robertwb opened a new pull request, #19266:
URL: https://github.com/apache/beam/pull/19266

   This is useful in cases where a Python external transform is used
   at construction, and then later the pipeline is run locally on the
   Python runner.
   
   Also removes an unnecessary warning as containers are now named
   according to their Python version.
   
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [ ] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`).
    - [ ] Add a link to the appropriate issue in your description, if applicable. This will automatically link the pull request to the issue.
    - [ ] Update `CHANGES.md` with noteworthy changes.
    - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://beam.apache.org/contribute/#make-reviewers-job-easier).
   
   To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
   
   GitHub Actions Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   [![Build python source distribution and wheels](https://github.com/apache/beam/workflows/Build%20python%20source%20distribution%20and%20wheels/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
   [![Python tests](https://github.com/apache/beam/workflows/Python%20tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Java tests](https://github.com/apache/beam/workflows/Java%20Tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
   
   See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI.
   


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] robertwb commented on a diff in pull request #19266: Add an option to run Python operations in-line when invoked as a remote runner.

Posted by GitBox <gi...@apache.org>.
robertwb commented on code in PR #19266:
URL: https://github.com/apache/beam/pull/19266#discussion_r890328987


##########
sdks/python/apache_beam/runners/dataflow/dataflow_job_service.py:
##########
@@ -34,31 +32,22 @@ def _invoke_runner(self):
     """Actually calls Dataflow and waits for completion.
     """
     runner = dataflow_runner.DataflowRunner()
-    result = runner.run_pipeline(
+    self.result = runner.run_pipeline(
         None, self.pipeline_options(), self._pipeline_proto)
     # Prefer this to result.wait_until_finish() to get state updates
     # and avoid creating an extra thread (which also messes with logging).
     dataflow_runner.DataflowRunner.poll_for_job_completion(
         runner,
-        result,
+        self.result,
         None,
         lambda dataflow_state: self.set_state(
             portable_runner.PipelineResult.pipeline_state_to_runner_api_state(
-                result.api_jobstate_to_pipeline_state(dataflow_state))))
-    return result
+                self.result.api_jobstate_to_pipeline_state(dataflow_state))))
+    return self.result
 
-  def pipeline_options(self):
-    def from_urn(key):
-      assert key.startswith('beam:option:')
-      assert key.endswith(':v1')
-      return key[12:-3]
-
-    return pipeline_options.PipelineOptions(
-        **{
-            from_urn(key): value
-            for (key, value
-                 ) in job_utils.struct_to_dict(self._pipeline_options).items()
-        })
+  def cancel(self):
+    if not self.is_terminal_state(self.state):
+      self.result.cancel()

Review Comment:
   This overrides/implements the default no-op version at https://github.com/apache/beam/blob/v2.39.0/sdks/python/apache_beam/runners/portability/local_job_service.py#L313



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] codecov[bot] commented on pull request #19266: Add an option to run Python operations in-line when invoked as a remote runner.

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #19266:
URL: https://github.com/apache/beam/pull/19266#issuecomment-1146456555

   # [Codecov](https://codecov.io/gh/apache/beam/pull/19266?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#19266](https://codecov.io/gh/apache/beam/pull/19266?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (62a8d00) into [master](https://codecov.io/gh/apache/beam/commit/f24cedf4edb1312f2d07df00d0f29569dfcb4b39?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f24cedf) will **decrease** coverage by `0.02%`.
   > The diff coverage is `42.85%`.
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #19266      +/-   ##
   ==========================================
   - Coverage   74.07%   74.04%   -0.03%     
   ==========================================
     Files         697      697              
     Lines       91927    91950      +23     
   ==========================================
   - Hits        68092    68088       -4     
   - Misses      22590    22617      +27     
     Partials     1245     1245              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | python | `83.69% <42.85%> (-0.04%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/beam/pull/19266?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [sdks/python/apache\_beam/transforms/environments.py](https://codecov.io/gh/apache/beam/pull/19266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdHJhbnNmb3Jtcy9lbnZpcm9ubWVudHMucHk=) | `88.26% <ø> (-0.04%)` | :arrow_down: |
   | [...eam/runners/portability/fn\_api\_runner/fn\_runner.py](https://codecov.io/gh/apache/beam/pull/19266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vcnVubmVycy9wb3J0YWJpbGl0eS9mbl9hcGlfcnVubmVyL2ZuX3J1bm5lci5weQ==) | `87.51% <14.28%> (-2.50%)` | :arrow_down: |
   | [...ache\_beam/runners/dataflow/dataflow\_job\_service.py](https://codecov.io/gh/apache/beam/pull/19266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vcnVubmVycy9kYXRhZmxvdy9kYXRhZmxvd19qb2Jfc2VydmljZS5weQ==) | `50.00% <60.00%> (-12.17%)` | :arrow_down: |
   | [...dks/python/apache\_beam/options/pipeline\_options.py](https://codecov.io/gh/apache/beam/pull/19266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vb3B0aW9ucy9waXBlbGluZV9vcHRpb25zLnB5) | `94.94% <100.00%> (+0.01%)` | :arrow_up: |
   | [...ache\_beam/runners/portability/local\_job\_service.py](https://codecov.io/gh/apache/beam/pull/19266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vcnVubmVycy9wb3J0YWJpbGl0eS9sb2NhbF9qb2Jfc2VydmljZS5weQ==) | `82.27% <100.00%> (+0.61%)` | :arrow_up: |
   | [...python/apache\_beam/runners/worker/worker\_status.py](https://codecov.io/gh/apache/beam/pull/19266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vcnVubmVycy93b3JrZXIvd29ya2VyX3N0YXR1cy5weQ==) | `77.53% <0.00%> (-2.18%)` | :arrow_down: |
   | [sdks/python/apache\_beam/internal/dill\_pickler.py](https://codecov.io/gh/apache/beam/pull/19266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vaW50ZXJuYWwvZGlsbF9waWNrbGVyLnB5) | `84.89% <0.00%> (-1.44%)` | :arrow_down: |
   | [...ks/python/apache\_beam/runners/worker/sdk\_worker.py](https://codecov.io/gh/apache/beam/pull/19266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vcnVubmVycy93b3JrZXIvc2RrX3dvcmtlci5weQ==) | `88.62% <0.00%> (-0.32%)` | :arrow_down: |
   | [sdks/python/apache\_beam/transforms/core.py](https://codecov.io/gh/apache/beam/pull/19266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdHJhbnNmb3Jtcy9jb3JlLnB5) | `92.14% <0.00%> (-0.16%)` | :arrow_down: |
   | [sdks/python/apache\_beam/coders/coders.py](https://codecov.io/gh/apache/beam/pull/19266/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vY29kZXJzL2NvZGVycy5weQ==) | `88.22% <0.00%> (-0.13%)` | :arrow_down: |
   | ... and [4 more](https://codecov.io/gh/apache/beam/pull/19266/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/beam/pull/19266?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/beam/pull/19266?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [f24cedf...62a8d00](https://codecov.io/gh/apache/beam/pull/19266?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] robertwb merged pull request #19266: Add an option to run Python operations in-line when invoked as a remote runner.

Posted by GitBox <gi...@apache.org>.
robertwb merged PR #19266:
URL: https://github.com/apache/beam/pull/19266


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] damccorm commented on a diff in pull request #19266: Add an option to run Python operations in-line when invoked as a remote runner.

Posted by GitBox <gi...@apache.org>.
damccorm commented on code in PR #19266:
URL: https://github.com/apache/beam/pull/19266#discussion_r890213535


##########
sdks/python/apache_beam/runners/dataflow/dataflow_job_service.py:
##########
@@ -34,31 +32,22 @@ def _invoke_runner(self):
     """Actually calls Dataflow and waits for completion.
     """
     runner = dataflow_runner.DataflowRunner()
-    result = runner.run_pipeline(
+    self.result = runner.run_pipeline(
         None, self.pipeline_options(), self._pipeline_proto)
     # Prefer this to result.wait_until_finish() to get state updates
     # and avoid creating an extra thread (which also messes with logging).
     dataflow_runner.DataflowRunner.poll_for_job_completion(
         runner,
-        result,
+        self.result,
         None,
         lambda dataflow_state: self.set_state(
             portable_runner.PipelineResult.pipeline_state_to_runner_api_state(
-                result.api_jobstate_to_pipeline_state(dataflow_state))))
-    return result
+                self.result.api_jobstate_to_pipeline_state(dataflow_state))))
+    return self.result
 
-  def pipeline_options(self):
-    def from_urn(key):
-      assert key.startswith('beam:option:')
-      assert key.endswith(':v1')
-      return key[12:-3]
-
-    return pipeline_options.PipelineOptions(
-        **{
-            from_urn(key): value
-            for (key, value
-                 ) in job_utils.struct_to_dict(self._pipeline_options).items()
-        })
+  def cancel(self):
+    if not self.is_terminal_state(self.state):
+      self.result.cancel()

Review Comment:
   Are we using this function anywhere/is there a reason to pull this out?



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] robertwb commented on pull request #19266: Add an option to run Python operations in-line when invoked as a remote runner.

Posted by GitBox <gi...@apache.org>.
robertwb commented on PR #19266:
URL: https://github.com/apache/beam/pull/19266#issuecomment-1147647378

   Thanks for the quick review!


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] robertwb commented on pull request #19266: Add an option to run Python operations in-line when invoked as a remote runner.

Posted by GitBox <gi...@apache.org>.
robertwb commented on PR #19266:
URL: https://github.com/apache/beam/pull/19266#issuecomment-1146462359

   R: @damccorm


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org