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

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

                Author: ASF GitHub Bot
            Created on: 04/Oct/19 17:48
            Start Date: 04/Oct/19 17:48
    Worklog Time Spent: 10m 
      Work Description: pabloem 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_r331615148
 
 

 ##########
 File path: sdks/python/apache_beam/examples/snippets/snippets_test.py
 ##########
 @@ -1266,6 +1266,59 @@ def expand(self, pcoll):
       lengths = p | beam.Create(["a", "ab", "abc"]) | ComputeWordLengths()
       assert_that(lengths, equal_to([1, 2, 3]))
 
+class AccessingValueProviderInfoAfterRunTest(unittest.TestCase):
+  """Tests for accessing value provider info after run."""
+
+  def test_accessing_valueprovider_info_after_run(self):
+    # [START AccessingValueProviderInfoAfterRunSnip1]
+
+    class MyOptions(PipelineOptions):
+      @classmethod
+      def _add_argparse_args(cls, parser):
+        # Use add_value_provider_argument for arguments to be templatable
+        # Use add_argument as usual for non-templatable arguments
+        parser.add_value_provider_argument('--string_value', type=str,
+                                           default='the quick brown fox jumps 
over the lazy dog')
+
+    class LogValueProvidersFn(beam.DoFn):
+      def __init__(self, string_vp):
+        self.string_vp = string_vp
+
+      # Define the DoFn that logs the ValueProvider value.
+      # 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, **kwargs):
 
 Review comment:
   You don't need the `kwargs`.
   
   ```suggestion
         def process(self, an_int):
   ```
 
----------------------------------------------------------------
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: 323617)
    Time Spent: 1h 40m  (was: 1.5h)

> 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: 1h 40m
>  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