Exemple #1
0
 def process_bundle(self, request, instruction_id):
   with self.get_bundle_processor(
       instruction_id,
       request.process_bundle_descriptor_reference) as bundle_processor:
     bundle_processor.process_bundle(instruction_id)
     return beam_fn_api_pb2.InstructionResponse(
         instruction_id=instruction_id,
         process_bundle=beam_fn_api_pb2.ProcessBundleResponse(
             metrics=bundle_processor.metrics(),
             monitoring_infos=bundle_processor.monitoring_infos()))
Exemple #2
0
 def process_bundle(self, request, instruction_id):
     with self.get_bundle_processor(
             instruction_id, request.process_bundle_descriptor_reference
     ) as bundle_processor:
         bundle_processor.process_bundle(instruction_id)
         return beam_fn_api_pb2.InstructionResponse(
             instruction_id=instruction_id,
             process_bundle=beam_fn_api_pb2.ProcessBundleResponse(
                 metrics=bundle_processor.metrics(),
                 monitoring_infos=bundle_processor.monitoring_infos()))
Exemple #3
0
 def process_bundle(self, request, instruction_id):
     bundle_processor = self.bundle_processor_cache.get(
         instruction_id, request.process_bundle_descriptor_id)
     try:
         with bundle_processor.state_handler.process_instruction_id(
                 instruction_id, request.cache_tokens):
             with self.maybe_profile(instruction_id):
                 delayed_applications, requests_finalization = (
                     bundle_processor.process_bundle(instruction_id))
                 monitoring_infos = bundle_processor.monitoring_infos()
                 monitoring_infos.extend(self.state_cache_metrics_fn())
                 response = beam_fn_api_pb2.InstructionResponse(
                     instruction_id=instruction_id,
                     process_bundle=beam_fn_api_pb2.ProcessBundleResponse(
                         residual_roots=delayed_applications,
                         metrics=bundle_processor.metrics(),
                         monitoring_infos=monitoring_infos,
                         requires_finalization=requests_finalization))
         # Don't release here if finalize is needed.
         if not requests_finalization:
             self.bundle_processor_cache.release(instruction_id)
         return response
     except:  # pylint: disable=broad-except
         # Don't re-use bundle processors on failure.
         self.bundle_processor_cache.discard(instruction_id)
         raise
Exemple #4
0
 def process_bundle(self, request, instruction_id):
   with self.get_bundle_processor(
       instruction_id,
       request.process_bundle_descriptor_reference) as bundle_processor:
     with self.maybe_profile(instruction_id):
       delayed_applications = bundle_processor.process_bundle(instruction_id)
     return beam_fn_api_pb2.InstructionResponse(
         instruction_id=instruction_id,
         process_bundle=beam_fn_api_pb2.ProcessBundleResponse(
             residual_roots=delayed_applications,
             metrics=bundle_processor.metrics(),
             monitoring_infos=bundle_processor.monitoring_infos()))
Exemple #5
0
 def process_bundle(self, request, instruction_id):
     with self.get_bundle_processor(
             instruction_id, request.process_bundle_descriptor_reference
     ) as bundle_processor:
         with self.maybe_profile(instruction_id):
             delayed_applications = bundle_processor.process_bundle(
                 instruction_id)
         return beam_fn_api_pb2.InstructionResponse(
             instruction_id=instruction_id,
             process_bundle=beam_fn_api_pb2.ProcessBundleResponse(
                 residual_roots=delayed_applications,
                 metrics=bundle_processor.metrics(),
                 monitoring_infos=bundle_processor.monitoring_infos()))
Exemple #6
0
 def process_bundle(self, request, instruction_id):
     bundle_processor = self.bundle_processor_cache.get(
         instruction_id, request.process_bundle_descriptor_reference)
     try:
         with bundle_processor.state_handler.process_instruction_id(
                 instruction_id):
             with self.maybe_profile(instruction_id):
                 delayed_applications = bundle_processor.process_bundle(
                     instruction_id)
                 response = beam_fn_api_pb2.InstructionResponse(
                     instruction_id=instruction_id,
                     process_bundle=beam_fn_api_pb2.ProcessBundleResponse(
                         residual_roots=delayed_applications,
                         metrics=bundle_processor.metrics(),
                         monitoring_infos=bundle_processor.monitoring_infos(
                         )))
         # TODO(boyuanz): Don't release here if finalize is needed.
         self.bundle_processor_cache.release(instruction_id)
         return response
     except:  # pylint: disable=broad-except
         # Don't re-use bundle processors on failure.
         self.bundle_processor_cache.discard(instruction_id)
         raise