You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by da...@apache.org on 2022/11/04 13:35:26 UTC

[beam] branch master updated: Immediately truncate full restriction on drain of periodic impulse (#23765)

This is an automated email from the ASF dual-hosted git repository.

damccorm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 7dba78d6110 Immediately truncate full restriction on drain of periodic impulse (#23765)
7dba78d6110 is described below

commit 7dba78d611089a1826c5655ed7ffcdf3f6007eae
Author: Danny McCormick <da...@google.com>
AuthorDate: Fri Nov 4 09:35:16 2022 -0400

    Immediately truncate full restriction on drain of periodic impulse (#23765)
    
    * Immediately truncate full restriction on drain of periodic impulse
    
    * Whitespace format
---
 sdks/python/apache_beam/transforms/periodicsequence.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sdks/python/apache_beam/transforms/periodicsequence.py b/sdks/python/apache_beam/transforms/periodicsequence.py
index 0417224c647..b2d7b375571 100644
--- a/sdks/python/apache_beam/transforms/periodicsequence.py
+++ b/sdks/python/apache_beam/transforms/periodicsequence.py
@@ -51,6 +51,10 @@ class ImpulseSeqGenRestrictionProvider(core.RestrictionProvider):
   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):
   '''