def process_bundle_progress(self, request, instruction_id): # It is an error to get progress for a not-in-flight bundle. processor = self.bundle_processors.get(request.instruction_reference) return beam_fn_api_pb2.InstructionResponse( instruction_id=instruction_id, process_bundle_progress=beam_fn_api_pb2.ProcessBundleProgressResponse( metrics=processor.metrics() if processor else None))
def process_bundle_progress( self, request, # type: beam_fn_api_pb2.ProcessBundleProgressRequest instruction_id # type: str ): # type: (...) -> beam_fn_api_pb2.InstructionResponse try: processor = self.bundle_processor_cache.lookup(request.instruction_id) except RuntimeError: return beam_fn_api_pb2.InstructionResponse( instruction_id=instruction_id, error=traceback.format_exc()) if processor: self._log_lull_in_bundle_processor(processor) monitoring_infos = processor.monitoring_infos() else: # Return an empty response if we aren't running. This can happen # if the ProcessBundleRequest has not started or already finished. monitoring_infos = [] return beam_fn_api_pb2.InstructionResponse( instruction_id=instruction_id, process_bundle_progress=beam_fn_api_pb2.ProcessBundleProgressResponse( monitoring_infos=monitoring_infos, monitoring_data={ SHORT_ID_CACHE.getShortId(info): info.payload for info in monitoring_infos }))
def process_bundle_progress(self, request, instruction_id): # It is an error to get progress for a not-in-flight bundle. processor = self.bundle_processor_cache.lookup(request.instruction_id) if processor: self._log_lull_in_bundle_processor(processor) return beam_fn_api_pb2.InstructionResponse( instruction_id=instruction_id, process_bundle_progress=beam_fn_api_pb2.ProcessBundleProgressResponse( metrics=processor.metrics() if processor else None, monitoring_infos=processor.monitoring_infos() if processor else []))
def process_bundle_progress(self, request, # type: beam_fn_api_pb2.ProcessBundleProgressRequest instruction_id # type: str ): # type: (...) -> beam_fn_api_pb2.InstructionResponse # It is an error to get progress for a not-in-flight bundle. processor = self.bundle_processor_cache.lookup(request.instruction_id) if processor: self._log_lull_in_bundle_processor(processor) monitoring_infos = processor.monitoring_infos() if processor else [] return beam_fn_api_pb2.InstructionResponse( instruction_id=instruction_id, process_bundle_progress=beam_fn_api_pb2.ProcessBundleProgressResponse( monitoring_infos=monitoring_infos, monitoring_data={ SHORT_ID_CACHE.getShortId(info): info.payload for info in monitoring_infos }))