From b3b257e6ce0957be633183f8402fe8458bc9c85e Mon Sep 17 00:00:00 2001 From: barrierye Date: Mon, 22 Jun 2020 21:07:00 +0800 Subject: [PATCH] change status_code to serving_status_code --- .../grpc_impl_example/fit_a_line/test_batch_client.py | 4 ++-- .../grpc_impl_example/fit_a_line/test_general_pb_client.py | 4 ++-- .../grpc_impl_example/fit_a_line/test_numpy_input_client.py | 4 ++-- .../grpc_impl_example/fit_a_line/test_sync_client.py | 4 ++-- .../grpc_impl_example/fit_a_line/test_timeout_client.py | 6 +++--- python/paddle_serving_client/__init__.py | 6 +++--- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/python/examples/grpc_impl_example/fit_a_line/test_batch_client.py b/python/examples/grpc_impl_example/fit_a_line/test_batch_client.py index 3a01040e..0630a0a9 100644 --- a/python/examples/grpc_impl_example/fit_a_line/test_batch_client.py +++ b/python/examples/grpc_impl_example/fit_a_line/test_batch_client.py @@ -26,7 +26,7 @@ x = [ for i in range(3): batch_feed = [{"x": x} for j in range(batch_size)] fetch_map = client.predict(feed=batch_feed, fetch=["price"]) - if fetch_map["status_code"] == 0: + if fetch_map["serving_status_code"] == 0: print(fetch_map) else: - print(fetch_map["status_code"]) + print(fetch_map["serving_status_code"]) diff --git a/python/examples/grpc_impl_example/fit_a_line/test_general_pb_client.py b/python/examples/grpc_impl_example/fit_a_line/test_general_pb_client.py index a5ad17e0..b2744906 100644 --- a/python/examples/grpc_impl_example/fit_a_line/test_general_pb_client.py +++ b/python/examples/grpc_impl_example/fit_a_line/test_general_pb_client.py @@ -24,7 +24,7 @@ x = [ ] for i in range(3): fetch_map = client.predict(feed={"x": x}, fetch=["price"], is_python=False) - if fetch_map["status_code"] == 0: + if fetch_map["serving_status_code"] == 0: print(fetch_map) else: - print(fetch_map["status_code"]) + print(fetch_map["serving_status_code"]) diff --git a/python/examples/grpc_impl_example/fit_a_line/test_numpy_input_client.py b/python/examples/grpc_impl_example/fit_a_line/test_numpy_input_client.py index 329eae6a..e98c1e87 100644 --- a/python/examples/grpc_impl_example/fit_a_line/test_numpy_input_client.py +++ b/python/examples/grpc_impl_example/fit_a_line/test_numpy_input_client.py @@ -25,7 +25,7 @@ x = [ ] for i in range(3): fetch_map = client.predict(feed={"x": np.array(x)}, fetch=["price"]) - if fetch_map["status_code"] == 0: + if fetch_map["serving_status_code"] == 0: print(fetch_map) else: - print(fetch_map["status_code"]) + print(fetch_map["serving_status_code"]) diff --git a/python/examples/grpc_impl_example/fit_a_line/test_sync_client.py b/python/examples/grpc_impl_example/fit_a_line/test_sync_client.py index 9f699846..89530dc2 100644 --- a/python/examples/grpc_impl_example/fit_a_line/test_sync_client.py +++ b/python/examples/grpc_impl_example/fit_a_line/test_sync_client.py @@ -24,7 +24,7 @@ x = [ ] for i in range(3): fetch_map = client.predict(feed={"x": x}, fetch=["price"]) - if fetch_map["status_code"] == 0: + if fetch_map["serving_status_code"] == 0: print(fetch_map) else: - print(fetch_map["status_code"]) + print(fetch_map["serving_status_code"]) diff --git a/python/examples/grpc_impl_example/fit_a_line/test_timeout_client.py b/python/examples/grpc_impl_example/fit_a_line/test_timeout_client.py index 4a2c2cff..f90fab38 100644 --- a/python/examples/grpc_impl_example/fit_a_line/test_timeout_client.py +++ b/python/examples/grpc_impl_example/fit_a_line/test_timeout_client.py @@ -26,9 +26,9 @@ x = [ ] for i in range(3): fetch_map = client.predict(feed={"x": x}, fetch=["price"]) - if fetch_map["status_code"] == 0: + if fetch_map["serving_status_code"] == 0: print(fetch_map) - elif fetch_map["status_code"] == grpc.StatusCode.DEADLINE_EXCEEDED: + elif fetch_map["serving_status_code"] == grpc.StatusCode.DEADLINE_EXCEEDED: print('timeout') else: - print(fetch_map["status_code"]) + print(fetch_map["serving_status_code"]) diff --git a/python/paddle_serving_client/__init__.py b/python/paddle_serving_client/__init__.py index d5d37c32..7362f469 100644 --- a/python/paddle_serving_client/__init__.py +++ b/python/paddle_serving_client/__init__.py @@ -569,7 +569,7 @@ class MultiLangClient(object): ret = list(multi_result_map.values())[0] else: ret = multi_result_map - ret["status_code"] = 0 + ret["serving_status_code"] = 0 return ret if not need_variant_tag else [ret, tag] def _done_callback_func(self, fetch, is_python, need_variant_tag): @@ -598,7 +598,7 @@ class MultiLangClient(object): is_python=is_python, need_variant_tag=need_variant_tag) except grpc.RpcError as e: - return {"status_code": e.code()} + return {"serving_status_code": e.code()} else: call_future = self.stub_.Inference.future( req, timeout=self.rpc_timeout_s_) @@ -619,7 +619,7 @@ class MultiLangPredictFuture(object): try: resp = self.call_future_.result() except grpc.RpcError as e: - return {"status_code": e.code()} + return {"serving_status_code": e.code()} return self.callback_func_(resp) def add_done_callback(self, fn): -- GitLab