Skip to content

Commit

Permalink
Immediately truncate full restriction on drain of periodic impulse (a…
Browse files Browse the repository at this point in the history
…pache#23765)

* Immediately truncate full restriction on drain of periodic impulse

* Whitespace format
  • Loading branch information
damccorm authored and ruslan-ikhsan committed Nov 11, 2022
1 parent 7ab6faf commit db5e7fe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sdks/python/apache_beam/transforms/periodicsequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def create_tracker(self, restriction):
def restriction_size(self, unused_element, restriction):
return restriction.size()

# On drain, immediately stop emitting new elements
def truncate(self, unused_element, unused_restriction):
return None


class ImpulseSeqGenDoFn(beam.DoFn):
'''
Expand Down

0 comments on commit db5e7fe

Please sign in to comment.