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/10/20 20:19:51 UTC
[beam] 01/01: Immediately truncate full restriction on drain of periodic impulse
This is an automated email from the ASF dual-hosted git repository.
damccorm pushed a commit to branch users/damccorm/periodicImpulseDrain
in repository https://gitbox.apache.org/repos/asf/beam.git
commit 86ff7d3d1a4d469ee604ef7e6e8b2239bc936e1e
Author: Danny McCormick <da...@google.com>
AuthorDate: Thu Oct 20 16:19:43 2022 -0400
Immediately truncate full restriction on drain of periodic impulse
---
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 56075a5acc7..4f8f41e1fbe 100644
--- a/sdks/python/apache_beam/transforms/periodicsequence.py
+++ b/sdks/python/apache_beam/transforms/periodicsequence.py
@@ -49,6 +49,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):