boyuanzz commented on a change in pull request #13144:
URL: https://github.com/apache/beam/pull/13144#discussion_r509687809
##########
File path: sdks/python/apache_beam/transforms/util.py
##########
@@ -751,24 +751,42 @@ class GroupIntoBatches(PTransform):
GroupIntoBatches is experimental. Its use case will depend on the runner if
it has support of States and Timers.
"""
- def __init__(self, batch_size):
+ def __init__(
+ self, batch_size, max_buffering_duration_secs=None, clock=time.time):
"""Create a new GroupIntoBatches with batch size.
Arguments:
batch_size: (required) How many elements should be in a batch
+ max_buffering_duration_secs: (optional) How long in seconds at most an
+ incomplete batch of elements is allowed to be buffered in the states.
+ The duration must be a positive second duration and should be given as
+ an int or float.
+ clock: (optional) an alternative to time.time (mostly for testing)
"""
self.batch_size = batch_size
+ if max_buffering_duration_secs is not None:
+ assert max_buffering_duration_secs > 0, \
Review comment:
You can use parenthesis to avoid using `\` as line continuation.
----------------------------------------------------------------
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]