robertwb 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_r405990026
##########
File path: sdks/python/apache_beam/runners/worker/bundle_processor.py
##########
@@ -629,28 +628,28 @@ def __init__(self,
self._transform_id = transform_id
self._key_coder = key_coder
self._window_coder = window_coder
- self._timer_family_specs = timer_family_specs
- self._timer_receivers = None # type: Optional[Dict[str,
operations.ConsumerSet]]
+ # A mapping of {timer_family_id: OutputStream}
+ self._timer_output_streams = {}
+ self._timer_coders_impl = {}
self._all_states = {
} # type: Dict[tuple, userstate.AccumulatingRuntimeState]
- def update_timer_receivers(self, receivers):
- # type: (operations._TaggedReceivers) -> None
-
- """TODO"""
- self._timer_receivers = {}
- for tag in self._timer_family_specs:
- self._timer_receivers[tag] = receivers.pop(tag)
+ def add_timer_info(self, timer_family_id, output_stream, coder_impl):
+ self._timer_output_streams[timer_family_id] = output_stream
+ self._timer_coders_impl[timer_family_id] = coder_impl
def get_timer(
self,
timer_spec,
key,
- window # type: windowed_value.BoundedWindow
- ):
+ window, # type: windowed_value.BoundedWindow
+ pane):
# type: (...) -> OutputTimer
- assert self._timer_receivers is not None
- return OutputTimer(key, window, self._timer_receivers[timer_spec.name])
+ output_stream = self._timer_output_streams[timer_spec.name]
Review comment:
If this were a single map rather that two parallel maps, you could write
something like
`output_tream, timer_coder_impl = self._timer_info(timer_spec.name]`
----------------------------------------------------------------
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