提交 21348b99 编写于 作者: B barrierye

bug fix

上级 eb443288
...@@ -29,11 +29,11 @@ x = np.array( ...@@ -29,11 +29,11 @@ x = np.array(
lp = LineProfiler() lp = LineProfiler()
lp_wrapper = lp(client.predict) lp_wrapper = lp(client.predict)
for i in range(3): for i in range(1):
fetch_map = lp_wrapper( fetch_map = lp_wrapper(
feed={"x": x}, fetch_with_type={"combine_op_output": "float"}) feed={"x": x}, fetch_with_type={"combine_op_output": "float"})
# fetch_map = client.predict( # fetch_map = client.predict(
# feed={"x": x}, fetch_with_type={"combine_op_output": "float"}) # feed={"x": x}, fetch_with_type={"combine_op_output": "float"})
print(fetch_map) print(fetch_map)
lp.print_stats() #lp.print_stats()
...@@ -72,7 +72,9 @@ cnn_op = UciOp( ...@@ -72,7 +72,9 @@ cnn_op = UciOp(
client_config="uci_housing_client/serving_client_conf.prototxt", client_config="uci_housing_client/serving_client_conf.prototxt",
server_name="127.0.0.1:9393", server_name="127.0.0.1:9393",
fetch_names=["price"], fetch_names=["price"],
concurrency=1) concurrency=1,
timeout=0.01,
retry=2)
bow_op = UciOp( bow_op = UciOp(
name="bow", name="bow",
...@@ -86,7 +88,9 @@ bow_op = UciOp( ...@@ -86,7 +88,9 @@ bow_op = UciOp(
client_config="uci_housing_client/serving_client_conf.prototxt", client_config="uci_housing_client/serving_client_conf.prototxt",
server_name="127.0.0.1:9393", server_name="127.0.0.1:9393",
fetch_names=["price"], fetch_names=["price"],
concurrency=1) concurrency=1,
timeout=-1,
retry=1)
combine_op = CombineOp( combine_op = CombineOp(
name="combine", name="combine",
...@@ -94,12 +98,14 @@ combine_op = CombineOp( ...@@ -94,12 +98,14 @@ combine_op = CombineOp(
in_dtype='float', in_dtype='float',
outputs=[out_channel], outputs=[out_channel],
out_dtype='float', out_dtype='float',
concurrency=1) concurrency=1,
timeout=-1,
retry=1)
logging.info(read_channel.debug()) logging.info(read_channel.debug())
logging.info(combine_channel.debug()) logging.info(combine_channel.debug())
logging.info(out_channel.debug()) logging.info(out_channel.debug())
pyserver = PyServer(profile=False) pyserver = PyServer(profile=False, retry=1)
pyserver.add_channel(read_channel) pyserver.add_channel(read_channel)
pyserver.add_channel(combine_channel) pyserver.add_channel(combine_channel)
pyserver.add_channel(out_channel) pyserver.add_channel(out_channel)
......
...@@ -42,12 +42,16 @@ class _TimeProfiler(object): ...@@ -42,12 +42,16 @@ class _TimeProfiler(object):
self._enable = enable self._enable = enable
def record(self, name_with_tag): def record(self, name_with_tag):
if self._enable is False:
return
name_with_tag = name_with_tag.split("_") name_with_tag = name_with_tag.split("_")
tag = name_with_tag[-1] tag = name_with_tag[-1]
name = '_'.join(name_with_tag[:-1]) name = '_'.join(name_with_tag[:-1])
self._time_record.put((name, tag, int(round(time.time() * 1000000)))) self._time_record.put((name, tag, int(round(time.time() * 1000000))))
def print_profile(self): def print_profile(self):
if self._enable is False:
return
sys.stderr.write(self._print_head) sys.stderr.write(self._print_head)
tmp = {} tmp = {}
while not self._time_record.empty(): while not self._time_record.empty():
...@@ -392,10 +396,12 @@ class Op(object): ...@@ -392,10 +396,12 @@ class Op(object):
for i in range(self._retry): for i in range(self._retry):
_profiler.record("{}{}-midp_0".format(self._name, _profiler.record("{}{}-midp_0".format(self._name,
concurrency_idx)) concurrency_idx))
if self._time > 0: if self._timeout > 0:
try: try:
middata = func_timeout.func_timeout( middata = func_timeout.func_timeout(
self._time, self.midprocess, args=(data, )) self._timeout,
self.midprocess,
args=(data, ))
except func_timeout.FunctionTimedOut: except func_timeout.FunctionTimedOut:
logging.error("error: timeout") logging.error("error: timeout")
error_info = "{}({}): timeout".format( error_info = "{}({}): timeout".format(
...@@ -520,6 +526,7 @@ class GeneralPythonService( ...@@ -520,6 +526,7 @@ class GeneralPythonService(
data = python_service_channel_pb2.ChannelData() data = python_service_channel_pb2.ChannelData()
data_id = self._get_next_id() data_id = self._get_next_id()
data.id = data_id data.id = data_id
data.is_error = 0
for idx, name in enumerate(request.feed_var_names): for idx, name in enumerate(request.feed_var_names):
logging.debug( logging.debug(
self._log('name: {}'.format(request.feed_var_names[idx]))) self._log('name: {}'.format(request.feed_var_names[idx])))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册