From 646a6e3dc6906c3ec328f47641a73f327d9bf57f Mon Sep 17 00:00:00 2001 From: tvalentyn Date: Fri, 19 Dec 2025 11:42:18 -0800 Subject: [PATCH 1/2] Update periodicsequence.py Change `return` to `break` to avoid the warning that a DoFn mixes 'return' and 'yield' in the same method. --- sdks/python/apache_beam/transforms/periodicsequence.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdks/python/apache_beam/transforms/periodicsequence.py b/sdks/python/apache_beam/transforms/periodicsequence.py index 82b6fd0330c9..3a13e0a2d6aa 100644 --- a/sdks/python/apache_beam/transforms/periodicsequence.py +++ b/sdks/python/apache_beam/transforms/periodicsequence.py @@ -169,11 +169,11 @@ def process( # we are too ahead of time, let's wait. restriction_tracker.defer_remainder( timestamp.Timestamp(current_output_timestamp)) - return + break if not restriction_tracker.try_claim(current_output_index): # nothing to claim, just stop - return + break output = self._get_output(current_output_index, current_output_timestamp) From 8200a95b9c2798841740d7968b58b60c7a94cd46 Mon Sep 17 00:00:00 2001 From: tvalentyn Date: Fri, 19 Dec 2025 11:59:21 -0800 Subject: [PATCH 2/2] Update periodicsequence.py Add a comment --- sdks/python/apache_beam/transforms/periodicsequence.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sdks/python/apache_beam/transforms/periodicsequence.py b/sdks/python/apache_beam/transforms/periodicsequence.py index 3a13e0a2d6aa..e2bdc3c6c0f8 100644 --- a/sdks/python/apache_beam/transforms/periodicsequence.py +++ b/sdks/python/apache_beam/transforms/periodicsequence.py @@ -186,6 +186,9 @@ def process( current_output_index += 1 + # Don't yield any values here so that the generator + # raises StopIteration when we break out of the while loop. + class PeriodicSequence(PTransform): '''