提交 72c7fe51 编写于 作者: F felixhjh

fix op init error, server doesn't quit

上级 daf7f568
...@@ -1281,6 +1281,7 @@ class Op(object): ...@@ -1281,6 +1281,7 @@ class Op(object):
return parsed_data_dict, need_profile_dict, profile_dict, logid_dict return parsed_data_dict, need_profile_dict, profile_dict, logid_dict
@ErrorCatch
def _run(self, concurrency_idx, input_channel, output_channels, def _run(self, concurrency_idx, input_channel, output_channels,
is_thread_op, trace_buffer, model_config, workdir, thread_num, is_thread_op, trace_buffer, model_config, workdir, thread_num,
device_type, devices, mem_optim, ir_optim, precision, use_mkldnn, device_type, devices, mem_optim, ir_optim, precision, use_mkldnn,
...@@ -1322,7 +1323,12 @@ class Op(object): ...@@ -1322,7 +1323,12 @@ class Op(object):
# init ops # init ops
profiler = None profiler = None
try: @ErrorCatch
def check_helper(self, is_thread_op, model_config, workdir,
thread_num, device_type, devices, mem_optim, ir_optim,
precision, use_mkldnn, mkldnn_cache_capacity, mkldnn_op_list,
mkldnn_bf16_op_list, min_subgraph_size, dynamic_shape_info):
if is_thread_op == False and self.client_type == "local_predictor": if is_thread_op == False and self.client_type == "local_predictor":
self.service_handler = local_service_handler.LocalServiceHandler( self.service_handler = local_service_handler.LocalServiceHandler(
model_config=model_config, model_config=model_config,
...@@ -1348,11 +1354,17 @@ class Op(object): ...@@ -1348,11 +1354,17 @@ class Op(object):
# check all ops initialized successfully. # check all ops initialized successfully.
profiler = self._initialize(is_thread_op, concurrency_idx) profiler = self._initialize(is_thread_op, concurrency_idx)
except Exception as e: _, resp = check_helper(self, is_thread_op, model_config, workdir,
_LOGGER.critical( thread_num, device_type, devices, mem_optim, ir_optim,
"{} failed to init op: {}".format(op_info_prefix, e), precision, use_mkldnn, mkldnn_cache_capacity, mkldnn_op_list,
exc_info=True) mkldnn_bf16_op_list, min_subgraph_size, dynamic_shape_info)
os._exit(-1)
if resp.err_no != CustomExceptionCode.OK.value:
raise CustomException(
CustomExceptionCode.INIT_ERROR,
"{} failed to init op: {}".format(op_info_prefix, resp.err_msg),
False)
_LOGGER.info("{} Succ init".format(op_info_prefix)) _LOGGER.info("{} Succ init".format(op_info_prefix))
batch_generator = self._auto_batching_generator( batch_generator = self._auto_batching_generator(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册