Skip to content

Commit

Permalink
some bug with serving client release
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxicoding committed Jun 28, 2020
1 parent 59611c8 commit 0f32c61
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions python/paddle_edl/distill/distill_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def predict(self, feed_data):


class PaddlePredictServer(PredictServer):
def __init__(self, server, config_file, feeds, fetchs, max_failed_times=3):
def __init__(self, server, config_file, feeds, fetchs, max_failed_times=2):
self._server = server
self._config_file = config_file
self._predict_feed_idxs = []
Expand Down Expand Up @@ -295,14 +295,15 @@ def predict(self, feed_data):
def __del__(self):
try:
# avoid serving exit bug when hasn't predict
if self.client is not None and self._has_predict:
self.client.release()
#if self.client is not None and self._has_predict:
# self.client.release()
pass
except Exception as e:
logger.critical('Release client failed with server={}, '
'there may be an unknown error'.format(
self._server))
logger.critical('Exception:\n{}'.format(str(e)))
logger.warning('Stopped predict server={}'.format(self._server))
#logger.warning('Stopped predict server={}'.format(self._server))


class _TestNopPaddlePredictServer(PaddlePredictServer):
Expand Down Expand Up @@ -362,19 +363,10 @@ def predict_signal_handle(signum, frame):
six.reraise(*sys.exc_info())


def predict_loop(server_item,
working_predict_count,
in_queue,
out_queue,
feeds,
fetchs,
conf_file,
stop_events,
predict_lock,
global_finished_task,
predict_cond,
thread_pool,
max_concurrent=3):
def predict_loop(server_item, working_predict_count, in_queue, out_queue,
feeds, fetchs, conf_file, stop_events, predict_lock,
global_finished_task, predict_cond, thread_pool,
max_concurrent):
logger.info('connect server={}'.format(server_item.server))
predict_server = PaddlePredictServer if _NOP_PREDICT_TEST is False else _TestNopPaddlePredictServer
idx = 0
Expand Down

0 comments on commit 0f32c61

Please sign in to comment.