[ 
https://issues.apache.org/jira/browse/BEAM-10341?focusedWorklogId=460599&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-460599
 ]

ASF GitHub Bot logged work on BEAM-10341:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 17/Jul/20 23:12
            Start Date: 17/Jul/20 23:12
    Worklog Time Spent: 10m 
      Work Description: lukecwik commented on a change in pull request #12289:
URL: https://github.com/apache/beam/pull/12289#discussion_r456708526



##########
File path: sdks/python/apache_beam/runners/worker/operations.py
##########
@@ -743,6 +743,32 @@ def pcollection_count_monitoring_infos(self, 
tag_to_pcollection_id):
     return infos
 
 
+class SdfTruncateSizedRestrictions(DoOperation):
+  def __init__(self, *args, **kwargs):
+    super(SdfTruncateSizedRestrictions, self).__init__(*args, **kwargs)
+    self.sdf_process_op = None
+    self.consumers_count = 0
+
+  def current_element_progress(self):
+    # type: () -> Optional[iobase.RestrictionProgress]
+    if self.consumers_count == 1 and self.sdf_process_op is None:
+      return None
+    return self.sdf_process_op.current_element_progress()
+
+  def try_split(self, fraction_of_remainder):  # type: (...) -> Optional[Any]
+    if self.consumers_count == 1 and self.sdf_process_op is None:
+      return None
+    return self.sdf_process_op.try_split(fraction_of_remainder)
+
+  def add_receiver(self, operation, output_index=0):

Review comment:
       We shouldn't need to record which is the sdf_process_op, we should be 
able to use `self.receivers[0].try_split` and 
`self.receivers[0].current_element_progress` regardless. It will only forward 
the split/progress if there is exactly one consumer and it supports splitting.

##########
File path: sdks/python/apache_beam/runners/worker/operations.py
##########
@@ -743,6 +743,32 @@ def pcollection_count_monitoring_infos(self, 
tag_to_pcollection_id):
     return infos
 
 
+class SdfTruncateSizedRestrictions(DoOperation):
+  def __init__(self, *args, **kwargs):
+    super(SdfTruncateSizedRestrictions, self).__init__(*args, **kwargs)
+    self.sdf_process_op = None
+    self.consumers_count = 0
+
+  def current_element_progress(self):
+    # type: () -> Optional[iobase.RestrictionProgress]
+    if self.consumers_count == 1 and self.sdf_process_op is None:
+      return None
+    return self.sdf_process_op.current_element_progress()
+
+  def try_split(self, fraction_of_remainder):  # type: (...) -> Optional[Any]

Review comment:
       Please fix the type, after #12275 it is:
   Optional[Tuple[Iterable[SdfSplitResultsPrimary], 
Iterable[SdfSplitResultsResidual]]




----------------------------------------------------------------
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.

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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 460599)
    Time Spent: 9h 50m  (was: 9h 40m)

> Support drain in SDF
> --------------------
>
>                 Key: BEAM-10341
>                 URL: https://issues.apache.org/jira/browse/BEAM-10341
>             Project: Beam
>          Issue Type: New Feature
>          Components: sdk-java-harness, sdk-py-harness
>            Reporter: Boyuan Zhang
>            Priority: P2
>          Time Spent: 9h 50m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to