[
https://issues.apache.org/jira/browse/BEAM-8335?focusedWorklogId=353688&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-353688
]
ASF GitHub Bot logged work on BEAM-8335:
----------------------------------------
Author: ASF GitHub Bot
Created on: 04/Dec/19 19:29
Start Date: 04/Dec/19 19:29
Worklog Time Spent: 10m
Work Description: rohdesamuel commented on pull request #10120:
[BEAM-8335] Add a TestStreamService Python Implementation
URL: https://github.com/apache/beam/pull/10120#discussion_r353938704
##########
File path: sdks/python/apache_beam/testing/test_stream_service_test.py
##########
@@ -0,0 +1,90 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+from __future__ import absolute_import
+
+import unittest
+
+import grpc
+
+from apache_beam.portability.api import beam_runner_api_pb2
+from apache_beam.portability.api import beam_runner_api_pb2_grpc
+from apache_beam.portability.api.beam_interactive_api_pb2 import
TestStreamFileHeader
+from apache_beam.portability.api.beam_interactive_api_pb2 import
TestStreamFileRecord
+from apache_beam.portability.api.beam_runner_api_pb2 import TestStreamPayload
+from apache_beam.testing.test_stream_service import TestStreamServiceController
+
+# Nose automatically detects tests if they match a regex. Here, it mistakens
+# these protos as tests. For more info see the Nose docs at:
+# https://nose.readthedocs.io/en/latest/writing_tests.html
+TestStreamPayload.__test__ = False
+TestStreamFileHeader.__test__ = False
+TestStreamFileRecord.__test__ = False
+
+
+class TestStreamServiceTest(unittest.TestCase):
+ def events(self):
+ for i in range(10):
+ e = TestStreamPayload.Event()
+ e.element_event.elements.append(
+ TestStreamPayload.TimestampedElement(timestamp=i))
+ yield e
+
+ def setUp(self):
+ self.controller = TestStreamServiceController(self.events)
+ self.controller.start()
+
+ channel = grpc.insecure_channel(self.controller.endpoint)
+ self.stub = beam_runner_api_pb2_grpc.TestStreamServiceStub(channel)
+
+ def tearDown(self):
+ self.controller.stop()
+
+ def test_normal_run(self):
+ r = self.stub.Events(beam_runner_api_pb2.EventsRequest())
+ events = [e for e in r]
+ expected_events = [e for e in self.events()]
+
+ self.assertEqual(events, expected_events)
+
+ def test_multiple_sessions(self):
+ resp_a = self.stub.Events(beam_runner_api_pb2.EventsRequest())
+ resp_b = self.stub.Events(beam_runner_api_pb2.EventsRequest())
+
+ events_a = []
+ events_b = []
+
+ done = False
+ while not done:
+ try:
+ events_a.append(next(resp_a))
+ except StopIteration:
+ done |= True
+
+ try:
+ events_b.append(next(resp_b))
+ except StopIteration:
+ done |= True
Review comment:
I changed it to have an explicit done variable for each events, "a_is_done"
and "b_is_done". I think this makes it easier to tell what's going on at a
glance.
----------------------------------------------------------------
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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 353688)
Time Spent: 41h 20m (was: 41h 10m)
> Add streaming support to Interactive Beam
> -----------------------------------------
>
> Key: BEAM-8335
> URL: https://issues.apache.org/jira/browse/BEAM-8335
> Project: Beam
> Issue Type: Improvement
> Components: runner-py-interactive
> Reporter: Sam Rohde
> Assignee: Sam Rohde
> Priority: Major
> Time Spent: 41h 20m
> Remaining Estimate: 0h
>
> This issue tracks the work items to introduce streaming support to the
> Interactive Beam experience. This will allow users to:
> * Write and run a streaming job in IPython
> * Automatically cache records from unbounded sources
> * Add a replay experience that replays all cached records to simulate the
> original pipeline execution
> * Add controls to play/pause/stop/step individual elements from the cached
> records
> * Add ability to inspect/visualize unbounded PCollections
--
This message was sent by Atlassian Jira
(v8.3.4#803005)