[
https://issues.apache.org/jira/browse/BEAM-8335?focusedWorklogId=352183&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-352183
]
ASF GitHub Bot logged work on BEAM-8335:
----------------------------------------
Author: ASF GitHub Bot
Created on: 02/Dec/19 20:36
Start Date: 02/Dec/19 20:36
Worklog Time Spent: 10m
Work Description: KevinGG commented on pull request #10236: [BEAM-8335]
Add method to PipelineInstrument to create background caching pipline
URL: https://github.com/apache/beam/pull/10236#discussion_r352815419
##########
File path:
sdks/python/apache_beam/runners/interactive/pipeline_instrument_test.py
##########
@@ -178,14 +183,48 @@ def test_has_unbounded_source(self):
p = beam.Pipeline(interactive_runner.InteractiveRunner())
_ = p | 'ReadUnboundedSource' >> beam.io.ReadFromPubSub(
subscription='projects/fake-project/subscriptions/fake_sub')
- self.assertTrue(instr.has_unbounded_source(p))
+ self.assertTrue(instr.has_unbounded_sources(p))
def test_not_has_unbounded_source(self):
p = beam.Pipeline(interactive_runner.InteractiveRunner())
with tempfile.NamedTemporaryFile(delete=False) as f:
f.write(b'test')
_ = p | 'ReadBoundedSource' >> beam.io.ReadFromText(f.name)
- self.assertFalse(instr.has_unbounded_source(p))
+ self.assertFalse(instr.has_unbounded_sources(p))
+
+ def test_background_caching_pipeline_proto(self):
+ p = beam.Pipeline(interactive_runner.InteractiveRunner())
+
+ # Test that the two ReadFromPubSub are correctly cut out.
+ a = p | 'ReadUnboundedSourceA' >> beam.io.ReadFromPubSub(
+ subscription='projects/fake-project/subscriptions/fake_sub')
+ b = p | 'ReadUnboundedSourceB' >> beam.io.ReadFromPubSub(
+ subscription='projects/fake-project/subscriptions/fake_sub')
+
+ # Add some extra PTransform afterwards to make sure that only the unbounded
+ # sources remain.
+ c = (a, b) | beam.CoGroupByKey()
+ _ = c | beam.Map(lambda x: x)
+
+ instrumenter = instr.PipelineInstrument(p)
+ instrumenter.instrument()
+ actual_pipeline = instrumenter.background_caching_pipeline_proto()
+
+ # Now recreate the expected pipeline, which should only have the unbounded
+ # sources.
+ p = beam.Pipeline(interactive_runner.InteractiveRunner())
+ a = p | 'ReadUnboundedSourceA' >> beam.io.ReadFromPubSub(
+ subscription='projects/fake-project/subscriptions/fake_sub')
+ instrumenter._write_cache(p, a)
Review comment:
If you want to use `_write_cache` as a static function in tests, maybe we
can extract the logic into `write_cache` in the module and reuse it in
`_write_cache` so that everything is self contained in `PipelineInstrument`
while those logic are also available as static functions outside of
`PipelineInstrument`.
An example is static `cacheable_key` in `pipeline_instrument` module and
`_cacheable_key` in `PipelineInstrument` class.
----------------------------------------------------------------
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: 352183)
Time Spent: 37h 20m (was: 37h 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: 37h 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)