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

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

                Author: ASF GitHub Bot
            Created on: 15/May/19 09:20
            Start Date: 15/May/19 09:20
    Worklog Time Spent: 10m 
      Work Description: robertwb commented on pull request #8408: [BEAM-7141] 
Add window & timestamp in timer callback method argument
URL: https://github.com/apache/beam/pull/8408#discussion_r284161773
 
 

 ##########
 File path: sdks/python/apache_beam/transforms/userstate_test.py
 ##########
 @@ -498,6 +502,39 @@ def process(self, element, ts=DoFn.TimestampParam):
         [('timer1', 10), ('timer2', 20), ('timer3', 30)],
         sorted(StatefulDoFnOnDirectRunnerTest.all_records))
 
+  def test_timer_output_timestamp_and_window(self):
+
+    class TimerEmittingStatefulDoFn(DoFn):
+      EMIT_TIMER_1 = TimerSpec('emit1', TimeDomain.WATERMARK)
+
+      def process(self, element, timer1=DoFn.TimerParam(EMIT_TIMER_1)):
+        timer1.set(10)
+
+      @on_timer(EMIT_TIMER_1)
+      def emit_callback_1(self,
+                          window=DoFn.WindowParam,
+                          ts=DoFn.TimestampParam):
+        yield ('timer1', int(ts), int(window.start), int(window.end))
+
+    pipeline_options = PipelineOptions()
+    pipeline_options.view_as(StandardOptions).streaming = True
 
 Review comment:
   Is this needed?
 
----------------------------------------------------------------
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: 242364)
    Time Spent: 2h  (was: 1h 50m)

> Expose kv and window parameters for on_timer
> --------------------------------------------
>
>                 Key: BEAM-7141
>                 URL: https://issues.apache.org/jira/browse/BEAM-7141
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-py-core
>    Affects Versions: 2.12.0
>            Reporter: Thomas Weise
>            Assignee: Rakesh Kumar
>            Priority: Major
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> We would like to have access to key and window inside the timer callback. 
> Without, it is also difficult to debug. We run into this while working onĀ 
> BEAM-7112



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to