提交 ffd8d3d7 编写于 作者: B barrierye

add brpc_predict_error in proto

上级 41f1570e
......@@ -501,6 +501,8 @@ class MultiLangClient(object):
def _unpack_resp(self, resp, fetch, is_python, need_variant_tag):
tag = resp.tag
if resp.brpc_predict_error:
return None if not need_variant_tag else [None, tag]
multi_result_map = {}
for model_result in resp.outputs:
inst = model_result.insts[0]
......
......@@ -518,9 +518,14 @@ class MultiLangServerService(
return feed_batch, fetch_names, is_python
def _pack_resp_package(self, results, fetch_names, is_python, tag):
resp = multi_lang_general_model_service_pb2.Response()
resp.tag = tag
if results is None:
resp.brpc_predict_error = True
return
resp.brpc_predict_error = False
if not self.is_multi_model_:
results = {'general_infer_0': results}
resp = multi_lang_general_model_service_pb2.Response()
for model_name, model_result in results.items():
model_output = multi_lang_general_model_service_pb2.ModelOutput()
inst = multi_lang_general_model_service_pb2.FetchInst()
......@@ -546,7 +551,6 @@ class MultiLangServerService(
model_output.insts.append(inst)
model_output.engine_name = model_name
resp.outputs.append(model_output)
resp.tag = tag
return resp
def inference(self, request, context):
......
......@@ -567,9 +567,14 @@ class MultiLangServerService(
return feed_batch, fetch_names, is_python
def _pack_resp_package(self, results, fetch_names, is_python, tag):
resp = multi_lang_general_model_service_pb2.Response()
resp.tag = tag
if results is None:
resp.brpc_predict_error = True
return
resp.brpc_predict_error = False
if not self.is_multi_model_:
results = {'general_infer_0': results}
resp = multi_lang_general_model_service_pb2.Response()
for model_name, model_result in results.items():
model_output = multi_lang_general_model_service_pb2.ModelOutput()
inst = multi_lang_general_model_service_pb2.FetchInst()
......@@ -595,7 +600,6 @@ class MultiLangServerService(
model_output.insts.append(inst)
model_output.engine_name = model_name
resp.outputs.append(model_output)
resp.tag = tag
return resp
def inference(self, request, context):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册