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

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

                Author: ASF GitHub Bot
            Created on: 09/Apr/20 07:21
            Start Date: 09/Apr/20 07:21
    Worklog Time Spent: 10m 
      Work Description: robertwb commented on pull request #11314: [BEAM-9562] 
Send Timers over Data Channel as Elements
URL: https://github.com/apache/beam/pull/11314#discussion_r406002550
 
 

 ##########
 File path: sdks/python/apache_beam/runners/worker/data_plane.py
 ##########
 @@ -408,27 +470,67 @@ def close_callback(data):
     return ClosableOutputStream.create(
         close_callback, add_to_send_queue, self._data_buffer_time_limit_ms)
 
+  def output_timer_stream(self, instruction_id, transform_id, timer_family_id):
+    def add_to_send_queue(timer):
+      if timer:
+        self._to_send.put(
+            beam_fn_api_pb2.Elements.Timer(
+                instruction_id=instruction_id,
+                transform_id=transform_id,
+                timer_family_id=timer_family_id,
+                timers=timer,
+                is_last=False))
+
+    def close_callback(timer):
+      add_to_send_queue(timer)
+      self._to_send.put(
+          beam_fn_api_pb2.Elements.Timer(
+              instruction_id=instruction_id,
+              transform_id=transform_id,
+              timer_family_id=timer_family_id,
+              timers=b'',
+              is_last=True))
+
+    return ClosableOutputStream.create(
+        close_callback, add_to_send_queue, self._data_buffer_time_limit_ms)
+
   def _write_outputs(self):
     # type: () -> Iterator[beam_fn_api_pb2.Elements]
-    done = False
-    while not done:
-      data = [self._to_send.get()]
-      try:
-        # Coalesce up to 100 other items.
-        for _ in range(100):
-          data.append(self._to_send.get_nowait())
-      except queue.Empty:
-        pass
-      if data[-1] is self._WRITES_FINISHED:
-        done = True
-        data.pop()
-      if data:
-        yield beam_fn_api_pb2.Elements(data=data)
+    stream_done = False
+    while not stream_done:
+      streams = None
+      if not stream_done:
 
 Review comment:
   This will always be true (given the loop condition). 
 
----------------------------------------------------------------
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: 419199)
    Time Spent: 17.5h  (was: 17h 20m)

> Remove timer from PCollection and treat timers as Elements 
> -----------------------------------------------------------
>
>                 Key: BEAM-9562
>                 URL: https://issues.apache.org/jira/browse/BEAM-9562
>             Project: Beam
>          Issue Type: New Feature
>          Components: sdk-java-harness, sdk-py-harness
>            Reporter: Boyuan Zhang
>            Assignee: Boyuan Zhang
>            Priority: Major
>             Fix For: 2.21.0
>
>          Time Spent: 17.5h
>  Remaining Estimate: 0h
>




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

Reply via email to