[ 
https://issues.apache.org/jira/browse/BEAM-7765?focusedWorklogId=326165&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-326165
 ]

ASF GitHub Bot logged work on BEAM-7765:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 10/Oct/19 08:01
            Start Date: 10/Oct/19 08:01
    Worklog Time Spent: 10m 
      Work Description: angulartist commented on pull request #9685: 
[BEAM-7765] - Add test for snippet accessing_valueprovider_info_after_run
URL: https://github.com/apache/beam/pull/9685#discussion_r333378753
 
 

 ##########
 File path: sdks/python/apache_beam/examples/snippets/snippets.py
 ##########
 @@ -1394,28 +1397,24 @@ def __init__(self, string_vp):
     # The DoFn is called when creating the pipeline branch.
     # This example logs the ValueProvider value, but
     # you could store it by pushing it to an external database.
-    def process(self, an_int):
+    def process(self, an_int, **kwargs):
       logging.info('The string_value is %s' % self.string_vp.get())
-      # Another option (where you don't need to pass the value at all) is:
-      logging.info('The string value is %s' %
-                   RuntimeValueProvider.get_value('string_value', str, ''))
 
   pipeline_options = PipelineOptions()
-  # Create pipeline.
-  p = beam.Pipeline(options=pipeline_options)
 
   my_options = pipeline_options.view_as(MyOptions)
-  # Add a branch for logging the ValueProvider value.
-  _ = (p
-       | beam.Create([None])
-       | 'LogValueProvs' >> beam.ParDo(
-           LogValueProvidersFn(my_options.string_value)))
-
-  # The main pipeline.
-  result_pc = (p
-               | "main_pc" >> beam.Create([1, 2, 3])
-               | beam.combiners.Sum.Globally())
 
-  p.run().wait_until_finish()
-
-  # [END AccessingValueProviderInfoAfterRunSnip1]
+  # Create pipeline.
+  with beam.Pipeline(options=my_options) as p:
+    # Add a branch for logging the ValueProvider value.
+    _ = (p
+         | beam.Create([None])
+         | 'LogValueProvider' >> beam.ParDo(
+              LogValueProvidersFn(my_options.string_value)))
+
+    # The main pipeline.
 
 Review comment:
   Sure, I've moved it to snippets_test.py
 
----------------------------------------------------------------
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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 326165)
    Time Spent: 2h  (was: 1h 50m)

> Add test for snippet accessing_valueprovider_info_after_run
> -----------------------------------------------------------
>
>                 Key: BEAM-7765
>                 URL: https://issues.apache.org/jira/browse/BEAM-7765
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-py-core
>            Reporter: Udi Meiri
>            Assignee: John Patoch
>            Priority: Major
>              Labels: easy
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> This snippet needs a unit test.
> It has bugs. For example:
> - apache_beam.utils.value_provider doesn't exist
> - beam.combiners.Sum doesn't exist
> - unused import of: WriteToText
> cc: [~pabloem]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to