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_r406474463
 
 

 ##########
 File path: 
sdks/python/apache_beam/runners/portability/fn_api_runner/execution.py
 ##########
 @@ -355,20 +364,41 @@ def _build_process_bundle_descriptor(self):
             items()),
         environments=dict(
             self.execution_context.pipeline_components.environments.items()),
-        state_api_service_descriptor=self.state_api_service_descriptor())
+        state_api_service_descriptor=self.state_api_service_descriptor(),
+        timer_api_service_descriptor=self.data_api_service_descriptor())
 
   def get_input_coder_impl(self, transform_id):
     # type: (str) -> CoderImpl
     coder_id = beam_fn_api_pb2.RemoteGrpcPort.FromString(
         self.process_bundle_descriptor.transforms[transform_id].spec.payload
     ).coder_id
     assert coder_id
+    return self.get_coder_impl(coder_id)
+
+  def _build_timer_coders_id_map(self):
+    timer_coder_ids = {}
+    for transform_id, transform_proto in (self._process_bundle_descriptor
+        .transforms.items()):
+      if transform_proto.spec.urn == common_urns.primitives.PAR_DO.urn:
+        pardo_payload = proto_utils.parse_Bytes(
+            transform_proto.spec.payload, beam_runner_api_pb2.ParDoPayload)
+        for id, timer_family_spec in pardo_payload.timer_family_specs.items():
+          timer_coder_ids[(transform_id, id)] = (
+              timer_family_spec.timer_family_coder_id)
+    return timer_coder_ids
+
+  def get_coder_impl(self, coder_id):
     if coder_id in self.execution_context.safe_coders:
       return self.execution_context.pipeline_context.coders[
           self.execution_context.safe_coders[coder_id]].get_impl()
     else:
       return 
self.execution_context.pipeline_context.coders[coder_id].get_impl()
 
+  def get_timer_coder_impl(self, transform_id, timer_family_id):
+    assert (transform_id, timer_family_id) in self._timer_coder_ids
 
 Review comment:
   The key error if it's not present below will be sufficient. 

----------------------------------------------------------------
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

Reply via email to