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

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

                Author: ASF GitHub Bot
            Created on: 01/Nov/19 01:57
            Start Date: 01/Nov/19 01:57
    Worklog Time Spent: 10m 
      Work Description: angoenka commented on pull request #9836: [BEAM-8435] 
Implement PaneInfo computation for Python.
URL: https://github.com/apache/beam/pull/9836#discussion_r341425717
 
 

 ##########
 File path: sdks/python/apache_beam/transforms/trigger.py
 ##########
 @@ -1162,12 +1173,33 @@ def process_timer(self, window_id, unused_name, 
time_domain, timestamp,
         if self.trigger_fn.should_fire(time_domain, timestamp,
                                        window, context):
           finished = self.trigger_fn.on_fire(timestamp, window, context)
-          yield self._output(window, finished, state)
+          yield self._output(window, finished, state, timestamp,
+                             time_domain == TimeDomain.WATERMARK)
     else:
       raise Exception('Unexpected time domain: %s' % time_domain)
 
-  def _output(self, window, finished, state):
+  def _output(self, window, finished, state, watermark, maybe_ontime):
     """Output window and clean up if appropriate."""
+    index = state.get_state(window, self.INDEX)
+    state.add_state(window, self.INDEX, 1)
+    if watermark <= window.max_timestamp():
+      nonspeculative_index = -1
+      timing = windowed_value.PaneInfoTiming.EARLY
+      if state.get_state(window, self.NONSPECULATIVE_INDEX):
+        logging.warning('Watermark moved backwards in time.')
+    else:
+      nonspeculative_index = state.get_state(window, self.NONSPECULATIVE_INDEX)
+      state.add_state(window, self.NONSPECULATIVE_INDEX, 1)
+      timing = (
+          windowed_value.PaneInfoTiming.ON_TIME
+          if maybe_ontime and nonspeculative_index == 0
 
 Review comment:
   `maybe_ontime` is False or null so pane can never be on_time
 
----------------------------------------------------------------
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:
us...@infra.apache.org


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

    Worklog Id:     (was: 337135)
    Time Spent: 40m  (was: 0.5h)

> Allow access to PaneInfo from Python DoFns
> ------------------------------------------
>
>                 Key: BEAM-8435
>                 URL: https://issues.apache.org/jira/browse/BEAM-8435
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-py-core
>            Reporter: Robert Bradshaw
>            Assignee: Robert Bradshaw
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> PaneInfoParam exists, but the plumbing to actually populate it at runtime was 
> never added. (Nor, clearly, were any tests...)



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

Reply via email to