scwhittle commented on code in PR #32513:
URL: https://github.com/apache/beam/pull/32513#discussion_r1773413227


##########
sdks/python/apache_beam/transforms/periodicsequence.py:
##########
@@ -48,14 +48,27 @@ def initial_restriction(self, element):
   def create_tracker(self, restriction):
     return OffsetRestrictionTracker(restriction)
 
-  def restriction_size(self, unused_element, restriction):
-    return restriction.size()
+  def restriction_size(self, element, restriction):
+    return sequence_backlog_bytes(element, time.time(), restriction)
 
   # On drain, immediately stop emitting new elements
   def truncate(self, unused_element, unused_restriction):
     return None
 
 
+def sequence_backlog_bytes(element, now, offset_range):

Review Comment:
   better if we match output bytes for autoscaling, added a comment



##########
sdks/python/apache_beam/transforms/periodicsequence.py:
##########
@@ -48,14 +48,27 @@ def initial_restriction(self, element):
   def create_tracker(self, restriction):
     return OffsetRestrictionTracker(restriction)
 
-  def restriction_size(self, unused_element, restriction):
-    return restriction.size()
+  def restriction_size(self, element, restriction):
+    return sequence_backlog_bytes(element, time.time(), restriction)
 
   # On drain, immediately stop emitting new elements
   def truncate(self, unused_element, unused_restriction):
     return None
 
 
+def sequence_backlog_bytes(element, now, offset_range):

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to