boyuanzz commented on a change in pull request #11314: [BEAM-9562] Send Timers
over Data Channel as Elements
URL: https://github.com/apache/beam/pull/11314#discussion_r405892978
##########
File path: sdks/python/apache_beam/runners/worker/bundle_processor.py
##########
@@ -562,45 +562,45 @@ class OutputTimer(object):
def __init__(self,
key,
window, # type: windowed_value.BoundedWindow
- receiver # type: operations.ConsumerSet
+ paneinfo,
+ timer_family_id,
+ timer_coder_impl,
+ output_stream
):
self._key = key
self._window = window
- self._receiver = receiver
+ self._paneinfo = paneinfo
+ self._timer_family_id = timer_family_id
+ self._output_stream = output_stream
+ self._timer_coder_impl = timer_coder_impl
def set(self, ts):
ts = timestamp.Timestamp.of(ts)
- # TODO(BEAM-9562): Plumb through actual timer fields.
- self._receiver.receive(
- windowed_value.WindowedValue((
- self._key,
- userstate.Timer(
- user_key='',
- dynamic_timer_tag='',
- windows=(self._window, ),
- clear_bit=False,
- fire_timestamp=ts,
- hold_timestamp=ts,
- paneinfo=windowed_value.PANE_INFO_UNKNOWN)),
- ts, (self._window, )))
+ timer = userstate.Timer(
+ user_key=self._key,
+ dynamic_timer_tag='',
+ windows=(self._window, ),
+ clear_bit=False,
+ fire_timestamp=ts,
+ hold_timestamp=ts,
+ paneinfo=self._paneinfo)
+ self._timer_coder_impl.encode_to_stream(timer, self._output_stream, True)
+ self._output_stream.maybe_flush()
def clear(self):
# type: () -> None
dummy_millis = int(common_urns.constants.MAX_TIMESTAMP_MILLIS.constant) + 1
clear_ts = timestamp.Timestamp(micros=dummy_millis * 1000)
- # TODO(BEAM-9562): Plumb through actual paneinfo.
- self._receiver.receive(
- windowed_value.WindowedValue((
- self._key,
- userstate.Timer(
- user_key='',
- dynamic_timer_tag='',
- windows=(self._window, ),
- clear_bit=False,
- fire_timestamp=timestamp.Timestamp.of(clear_ts),
- hold_timestamp=timestamp.Timestamp.of(0),
- paneinfo=windowed_value.PANE_INFO_UNKNOWN)),
- 0, (self._window, )))
+ timer = userstate.Timer(
+ user_key=self._key,
+ dynamic_timer_tag='',
+ windows=(self._window, ),
+ clear_bit=False,
+ fire_timestamp=clear_ts,
Review comment:
> (Should the coder be ignoring them as well?)
No, the timer coder is encoding all of these info now.
> Don't bother setting these timestamps, or paneinfo.
Could you please explain more about this?
----------------------------------------------------------------
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]
With regards,
Apache Git Services