[
https://issues.apache.org/jira/browse/BEAM-8335?focusedWorklogId=365954&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-365954
]
ASF GitHub Bot logged work on BEAM-8335:
----------------------------------------
Author: ASF GitHub Bot
Created on: 03/Jan/20 19:26
Start Date: 03/Jan/20 19:26
Worklog Time Spent: 10m
Work Description: KevinGG commented on pull request #10442: [BEAM-8335]
On Unbounded Source change
URL: https://github.com/apache/beam/pull/10442#discussion_r362931006
##########
File path:
sdks/python/apache_beam/runners/interactive/background_caching_job_test.py
##########
@@ -99,6 +117,89 @@ def
test_background_caching_job_not_start_when_such_job_is_done(self):
self.assertIs(main_job_result,
ie.current_env().pipeline_result(p))
+ @patch('IPython.get_ipython', new_callable=mock_get_ipython)
+ def test_source_to_cache_changed_when_pipeline_is_first_time_seen(self,
cell):
+ with cell: # Cell 1
+ pipeline = _build_an_empty_stream_pipeline()
+
+ with cell: # Cell 2
+ read_foo = pipeline | 'Read' >> beam.io.ReadFromPubSub(
+ subscription=_FOO_PUBSUB_SUB)
+ ib.watch({'read_foo': read_foo})
+
+ self.assertTrue(bcj.is_source_to_cache_changed(pipeline))
+
+ @patch('IPython.get_ipython', new_callable=mock_get_ipython)
+ def test_source_to_cache_changed_when_new_source_is_added(self, cell):
+ with cell: # Cell 1
+ pipeline = _build_an_empty_stream_pipeline()
+ read_foo = pipeline | 'Read' >> beam.io.ReadFromPubSub(
+ subscription=_FOO_PUBSUB_SUB)
+ ib.watch({'read_foo': read_foo})
+
+ # Sets the signature for current pipeline state.
+ ie.current_env().set_cached_source_signature(
+ pipeline, bcj.extract_source_to_cache_signature(pipeline))
+
+ with cell: # Cell 2
+ read_bar = pipeline | 'Read' >> beam.io.ReadFromPubSub(
+ subscription=_BAR_PUBSUB_SUB)
+ ib.watch({'read_bar': read_bar})
+
+ self.assertTrue(bcj.is_source_to_cache_changed(pipeline))
+
+ @patch('IPython.get_ipython', new_callable=mock_get_ipython)
+ def test_source_to_cache_changed_when_source_is_altered(self, cell):
+ with cell: # Cell 1
+ pipeline = _build_an_empty_stream_pipeline()
+ transform = beam.io.ReadFromPubSub(
+ subscription=_FOO_PUBSUB_SUB)
+ read_foo = pipeline | 'Read' >> transform
+ ib.watch({'read_foo': read_foo})
+
+ # Sets the signature for current pipeline state.
+ ie.current_env().set_cached_source_signature(
+ pipeline, bcj.extract_source_to_cache_signature(pipeline))
+
+ with cell: # Cell 2
+ from apache_beam.io.gcp.pubsub import _PubSubSource
+ # Alter the transform.
+ transform._source = _PubSubSource(subscription=_BAR_PUBSUB_SUB)
+
+ self.assertTrue(bcj.is_source_to_cache_changed(pipeline))
+
+ @patch('IPython.get_ipython', new_callable=mock_get_ipython)
+ def test_source_to_cache_not_changed_for_same_source(self, cell):
+ with cell: # Cell 1
+ pipeline = _build_an_empty_stream_pipeline()
+ transform = beam.io.ReadFromPubSub(
+ subscription='projects/test-project/subscriptions/dummy')
+
+ with cell: # Cell 2
+ read_foo_1 = pipeline | 'Read' >> transform
+ ib.watch({'read_foo_1': read_foo_1})
+
+ # Sets the signature for current pipeline state.
+ ie.current_env().set_cached_source_signature(
+ pipeline, bcj.extract_source_to_cache_signature(pipeline))
+
+ with cell: # Cell 3
+ # Apply exactly the same transform and the same instance.
+ read_foo_2 = pipeline | 'Read' >> transform
+ ib.watch({'read_foo_2': read_foo_2})
+
+ self.assertFalse(bcj.is_source_to_cache_changed(pipeline))
+
+ with cell: # Cell 4
+ # Apply the same transform but represented in a different instance.
+ # The signature representing the urn and payload is still the same, so it
+ # is not treated as a new unbounded source.
+ read_foo_3 = pipeline | 'Read' >> beam.io.ReadFromPubSub(
+ subscription='projects/test-project/subscriptions/dummy')
+ ib.watch({'read_foo_3': read_foo_3})
+
+ self.assertFalse(bcj.is_source_to_cache_changed(pipeline))
+
Review comment:
Yes, added a test for the scenario.
----------------------------------------------------------------
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: 365954)
Time Spent: 51h 50m (was: 51h 40m)
> 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: 51h 50m
> 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)