rohdesamuel commented on a change in pull request #12704:
URL: https://github.com/apache/beam/pull/12704#discussion_r486566349
##########
File path: sdks/python/apache_beam/runners/interactive/interactive_beam.py
##########
@@ -273,6 +270,10 @@ def show(*pcolls, **configs):
The given pcolls can be dictionary of PCollections (as values), or iterable
of PCollections or plain PCollection values.
+ The user can specify either the max number of elements with `n` to read
+ or the maximum duration of elements to read with `duration`. When a limiter
is
+ not supplied, it is assumed to be infinite.
+
There are 2 boolean configurations:
Review comment:
Done, added some arg doc strings.
##########
File path: sdks/python/apache_beam/runners/interactive/interactive_beam.py
##########
@@ -342,121 +343,79 @@ def show(*pcolls, **configs):
assert isinstance(pcoll, beam.pvalue.PCollection), (
'{} is not an apache_beam.pvalue.PCollection.'.format(pcoll))
user_pipeline = pcolls[0].pipeline
- for pcoll in pcolls:
- assert pcoll.pipeline is user_pipeline, (
- '{} belongs to a different user-defined pipeline ({}) than that of'
- ' other PCollections ({}).'.format(
- pcoll, pcoll.pipeline, user_pipeline))
+
# TODO(BEAM-8288): Remove below pops and assertion once Python 2 is
# deprecated from Beam.
include_window_info = configs.pop('include_window_info', False)
visualize_data = configs.pop('visualize_data', False)
+ n = configs.pop('n', 'inf')
+ duration = configs.pop('duration', 'inf')
+
+ if n == 'inf':
+ n = float('inf')
+
+ if duration == 'inf':
+ duration = float('inf')
+
# This assertion is to protect the backward compatibility for function
# signature change after Python 2 deprecation.
assert not configs, (
'The only configs supported are include_window_info and '
'visualize_data.')
Review comment:
Done
----------------------------------------------------------------
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]