[
https://issues.apache.org/jira/browse/BEAM-8335?focusedWorklogId=352191&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-352191
]
ASF GitHub Bot logged work on BEAM-8335:
----------------------------------------
Author: ASF GitHub Bot
Created on: 02/Dec/19 20:39
Start Date: 02/Dec/19 20:39
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_r352814058
##########
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()
Review comment:
You can use static function `instr.pin(p)` to create the `instrumenter`.
There are actually three steps (I think you missed the `preprocess` but you
might not need it for your tests):
```
pi = PipelineInstrument(pipeline, options)
pi.preprocess()
pi.instrument() # Instruments the pipeline only once.
return pi
```
----------------------------------------------------------------
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: 352191)
Time Spent: 38h 20m (was: 38h 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: 38h 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)