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

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

                Author: ASF GitHub Bot
            Created on: 15/Mar/18 22:50
            Start Date: 15/Mar/18 22:50
    Worklog Time Spent: 10m 
      Work Description: charlesccychen commented on a change in pull request 
#4838: [BEAM-3818] Add support for streaming side inputs in the DirectRunner
URL: https://github.com/apache/beam/pull/4838#discussion_r174956114
 
 

 ##########
 File path: sdks/python/apache_beam/testing/test_stream_test.py
 ##########
 @@ -245,6 +247,82 @@ def fired_elements(elem):
     # TODO(BEAM-3377): Remove after assert_that in streaming is fixed.
     self.assertEqual([('k', ['a'])], result)
 
+  def test_basic_execution_sideinputs_batch(self):
+
+    # TODO(BEAM-3377): Remove after assert_that in streaming is fixed.
+    global result     # pylint: disable=global-variable-undefined
+    result = []
+
+    def recorded_elements(elem):
+      result.append(elem)
+      return elem
+
+    options = PipelineOptions()
+    options.view_as(StandardOptions).streaming = True
+    p = TestPipeline(options=options)
+
+    main_stream = (p
+                   | 'main TestStream' >> TestStream()
+                   .advance_watermark_to(10)
+                   .add_elements(['e']))
+    side = (p
+            | beam.Create([2, 1, 4])
+            | beam.Map(lambda t: window.TimestampedValue(t, t)))
+
+    class RecordFn(beam.DoFn):
+      def process(self,
+                  elm=beam.DoFn.ElementParam,
+                  ts=beam.DoFn.TimestampParam,
+                  side=beam.DoFn.SideInputParam):
+        yield (elm, ts, side)
+
+    records = main_stream | beam.ParDo(RecordFn(), beam.pvalue.AsList(side)) | 
beam.Map(recorded_elements) # pylint: disable=line-too-long, unused-variable
 
 Review comment:
   <!--new_thread; commit:2053e91ce5cf41b329a4bf8bdb48a06b79b3626b; 
resolved:0-->
   Can you use the multi-line form to avoid the line-too-long?  You can also 
just avoid creating the `records` variable.
   
   ```
   (main_stream
    | beam.ParDo(RecordFn, ...)
    | beam.Map(...))
   ```

----------------------------------------------------------------
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:
[email protected]


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

    Worklog Id:     (was: 80999)
    Time Spent: 0.5h  (was: 20m)

> Add support for the streaming side inputs in the Python DirectRunner
> --------------------------------------------------------------------
>
>                 Key: BEAM-3818
>                 URL: https://issues.apache.org/jira/browse/BEAM-3818
>             Project: Beam
>          Issue Type: New Feature
>          Components: sdk-py-core
>            Reporter: María GH
>            Assignee: María GH
>            Priority: Minor
>             Fix For: 3.0.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> The streaming DirectRunner should support streaming side input semantics.  
> Currently, side inputs are only available for globally-windowed side input 
> PCollections.
> Also, empty side inputs cause a pipeline stall.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to