Skip to content

Commit

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

* Immediately truncate full restriction on drain of periodic impulse

* Whitespace format
  • Loading branch information
damccorm authored Nov 4, 2022
1 parent 1685251 commit 7dba78d
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 7dba78d

Please sign in to comment.