From 68dc58999221f316a7a2c8cb024d5455ebff3bdd Mon Sep 17 00:00:00 2001 From: barrierye Date: Thu, 2 Jul 2020 15:36:11 +0800 Subject: [PATCH] exit when an exception occurs when init client in op --- python/pipeline/operator.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/python/pipeline/operator.py b/python/pipeline/operator.py index ef467b6c..8fb3d2cc 100644 --- a/python/pipeline/operator.py +++ b/python/pipeline/operator.py @@ -321,15 +321,16 @@ class Op(object): log = get_log_func(op_info_prefix) tid = threading.current_thread().ident - # create client based on client_type - client = self.init_client(client_type, self._client_config, - self._server_endpoints, self._fetch_names) + client = None client_predict_handler = None - if self.with_serving: - client_predict_handler = client.predict - - # load user resources try: + # create client based on client_type + client = self.init_client(client_type, self._client_config, + self._server_endpoints, self._fetch_names) + if client is not None: + client_predict_handler = client.predict + + # load user resources self.load_user_resources() except Exception as e: _LOGGER.error(log(e)) -- GitLab