diff --git a/mindspore_serving/ccsrc/common/proto_tensor.cc b/mindspore_serving/ccsrc/common/proto_tensor.cc index a0f342944531ce66b34b6437232e936bac8a11b0..98cca018581e3020a337f3718ac64437fc3cd72c 100644 --- a/mindspore_serving/ccsrc/common/proto_tensor.cc +++ b/mindspore_serving/ccsrc/common/proto_tensor.cc @@ -241,7 +241,7 @@ Status GrpcTensorHelper::CreateInstanceFromRequest(const proto::PredictRequest & MethodSignature method_signature; if (!servable_signature.GetMethodDeclare(request_spec->method_name, &method_signature)) { return INFER_STATUS_LOG_ERROR(INVALID_INPUTS) - << "Method " << method_name << " is not registed for servable " << servable_name; + << "Method " << method_name << " is not registered for servable " << servable_name; } // instance @@ -268,7 +268,7 @@ Status GrpcTensorHelper::CreateReplyFromInstances(const proto::PredictRequest &r MethodSignature method_signature; if (!servable_signature.GetMethodDeclare(method_name, &method_signature)) { return INFER_STATUS_LOG_ERROR(INVALID_INPUTS) - << "Method " << method_name << " is not registed for servable " << servable_name; + << "Method " << method_name << " is not registered for servable " << servable_name; } *reply->mutable_servable_spec() = request.servable_spec(); diff --git a/mindspore_serving/ccsrc/master/restful/http_process.cc b/mindspore_serving/ccsrc/master/restful/http_process.cc index da79c301262e1b71caec4da48a54048b5f5ac4b7..7b9b94756fe8e4cf77944eb7e9e87827f426b6f2 100644 --- a/mindspore_serving/ccsrc/master/restful/http_process.cc +++ b/mindspore_serving/ccsrc/master/restful/http_process.cc @@ -257,7 +257,8 @@ Status RestfulService::CheckReqJsonValid(const json &js_msg) { } if (count != 1) { - return INFER_STATUS_LOG_ERROR(INVALID_INPUTS) << "key 'instances' should exit and only exit one time"; + return INFER_STATUS_LOG_ERROR(INVALID_INPUTS) + << "key 'instances' expects to exist once, but actually " << count << " times"; } return SUCCESS; } @@ -680,7 +681,7 @@ Status RestfulService::RunRestful(const std::shared_ptr &restful MSI_TIME_STAMP_END(ParseRequest) if (status != SUCCESS) { std::string error_msg = status.StatusMessage(); - std::string msg = "Parser reqeust failed, " + error_msg; + std::string msg = "Parser request failed, " + error_msg; status = msg; return status; } @@ -730,7 +731,7 @@ Status RestfulService::ParseRequest(const std::shared_ptr &restf status = ParseInstancesMsg(js_msg, request); break; default: - return INFER_STATUS_LOG_ERROR(FAILED) << "restful reqeust only support instances mode"; + return INFER_STATUS_LOG_ERROR(FAILED) << "restful request only support instances mode"; } return status; diff --git a/mindspore_serving/ccsrc/master/restful/restful_server.cc b/mindspore_serving/ccsrc/master/restful/restful_server.cc index b9acec8b4662aafe405f45756db5030c2c7e6273..71e6d85afe4b6f741f270197ad8433567ed3756a 100644 --- a/mindspore_serving/ccsrc/master/restful/restful_server.cc +++ b/mindspore_serving/ccsrc/master/restful/restful_server.cc @@ -114,7 +114,7 @@ Status RestfulServer::CreatRestfulServer(int time_out_second) { event_http_ = evhttp_new(event_base_); if (event_http_ == nullptr) { status = INFER_STATUS_LOG_ERROR(SYSTEM_ERROR) - << "Serving Error: RESTful server start failed, create http server faild"; + << "Serving Error: RESTful server start failed, create http server failed"; free_event_base(); return status; } @@ -148,7 +148,7 @@ Status RestfulServer::StartRestfulServer() { if (listener == nullptr) { status = INFER_STATUS_LOG_ERROR(SYSTEM_ERROR) - << "Serving Error: RESTful server start failed, create http listener faild, port " << restful_port_; + << "Serving Error: RESTful server start failed, create http listener failed, port " << restful_port_; free_event_base(); free_evhttp(); return status; @@ -156,7 +156,7 @@ Status RestfulServer::StartRestfulServer() { auto bound = evhttp_bind_listener(event_http_, listener); if (bound == nullptr) { status = INFER_STATUS_LOG_ERROR(SYSTEM_ERROR) - << "Serving Error: RESTful server start failed, bind http listener to server faild, port " + << "Serving Error: RESTful server start failed, bind http listener to server failed, port " << restful_port_; evconnlistener_free(listener); free_event_base(); diff --git a/mindspore_serving/ccsrc/worker/context.cc b/mindspore_serving/ccsrc/worker/context.cc index accd0b3d7bbda9276dec59c51800f73c98a37cde..3cdfd63c335cf00069720dc9bf8231cb99f5dff9 100644 --- a/mindspore_serving/ccsrc/worker/context.cc +++ b/mindspore_serving/ccsrc/worker/context.cc @@ -52,7 +52,7 @@ Status ServableContext::SetDeviceTypeStr(const std::string &device_type) { type = kDeviceTypeNotSpecified; } else { return INFER_STATUS_LOG_ERROR(FAILED) - << "Unsupport device type '" << device_type + << "Unsupported device type '" << device_type << "', only support 'Ascend', 'Davinci'(same with 'Ascend') and None, case ignored"; } SetDeviceType(type); diff --git a/mindspore_serving/worker/check_type.py b/mindspore_serving/worker/check_type.py index 097fb38343188f44b6f8981e380738f428bfc162..28155daebe7db6f1d371860ba0c9583ad511f587 100644 --- a/mindspore_serving/worker/check_type.py +++ b/mindspore_serving/worker/check_type.py @@ -33,7 +33,7 @@ def check_and_as_str_tuple_list(arg_name, strs): if not item: raise RuntimeError(f"The item of parameter '{arg_name}' should not be empty str") if item in str_list: - raise RuntimeError(f"The item name '{item}' in parameter '{arg_name}' should not be repeated") + raise RuntimeError(f"The item value '{item}' in parameter '{arg_name}' should not be repeated") str_list.append(item) return tuple(strs) @@ -53,18 +53,25 @@ def check_bool(arg_name, bool_val): raise RuntimeError(f"Parameter '{arg_name}' should be bool, but actually {type(bool_val)}") -def check_int(arg_name, int_val, mininum=None, maximum=None): +def check_int(arg_name, int_val, mininum=None, maximum=None, is_tuple_item=False): """Check whether the input parameters are reasonable int input""" + if not is_tuple_item: + prefix = f"Parameter '{arg_name}'" + else: + prefix = f"The item value '{int_val}' in parameter '{arg_name}'" + + if isinstance(int_val, bool): + raise RuntimeError(f"{prefix} should be int, but actually {type(int_val)}") if not isinstance(int_val, int): - raise RuntimeError(f"Parameter '{arg_name}' should be int, but actually {type(int_val)}") + raise RuntimeError(f"{prefix} should be int, but actually {type(int_val)}") if mininum is not None and int_val < mininum: if maximum is not None: - raise RuntimeError(f"Parameter '{arg_name}' should be in range [{mininum},{maximum}]") - raise RuntimeError(f"Parameter '{arg_name}' should be >= {mininum}") + raise RuntimeError(f"{prefix} should be in range [{mininum},{maximum}]") + raise RuntimeError(f"{prefix} should be >= {mininum}") if maximum is not None and int_val > maximum: if mininum is not None: - raise RuntimeError(f"Parameter '{arg_name}' should be in range [{mininum},{maximum}]") - raise RuntimeError(f"Parameter '{arg_name}' should be <= {maximum}") + raise RuntimeError(f"{prefix} should be in range [{mininum},{maximum}]") + raise RuntimeError(f"{prefix} should be <= {maximum}") def check_ip_port(arg_name, port): @@ -85,11 +92,9 @@ def check_and_as_int_tuple_list(arg_name, ints, mininum=None, maximum=None): if isinstance(ints, (tuple, list)): int_list = [] for item in ints: - if not isinstance(item, int): - raise RuntimeError(f"The item of parameter '{arg_name}' should be int, but actually {type(item)}") if item in int_list: - raise RuntimeError(f"The item name '{item}' in parameter '{arg_name}' should not be repeated") - check_int(arg_name, item, mininum, maximum) + raise RuntimeError(f"The item value '{item}' in parameter '{arg_name}' should not be repeated") + check_int(arg_name, item, mininum, maximum, True) int_list.append(item) return tuple(ints) diff --git a/mindspore_serving/worker/register/method.py b/mindspore_serving/worker/register/method.py index 2f9452006256ae90c006b6a3be82ca1a8d738964..b42fafcaac389c326f0922f8c6d444f43f5a1f6e 100644 --- a/mindspore_serving/worker/register/method.py +++ b/mindspore_serving/worker/register/method.py @@ -102,7 +102,7 @@ def _wrap_fun_to_pipeline(fun, input_count): argspec_len = len(inspect.signature(fun).parameters) if argspec_len != input_count: raise RuntimeError(f"function {fun.__name__} input args count {argspec_len} not match " - f"registed in method count {input_count}") + f"registered in method count {input_count}") @wraps(fun) def call_func(instances): @@ -460,7 +460,7 @@ def register_method(output_names): output_tensors = (output_tensors,) if len(output_tensors) != len(output_names): raise RuntimeError( - f"Method return output size {len(output_tensors)} not match registed {len(output_names)}") + f"Method return output size {len(output_tensors)} not match registered {len(output_names)}") method_def_context_.returns = [item.as_pair() for item in output_tensors] logger.info(f"Register method: method_name {method_def_context_.method_name} " diff --git a/third_party/mindspore b/third_party/mindspore index 6622be5207aa32bed2a3e937dd747bbf03223555..593952fcdf701a43acbbcccfc8f34b4592151af7 160000 --- a/third_party/mindspore +++ b/third_party/mindspore @@ -1 +1 @@ -Subproject commit 6622be5207aa32bed2a3e937dd747bbf03223555 +Subproject commit 593952fcdf701a43acbbcccfc8f34b4592151af7