From 1f9f172c471807a211e2fe2f997cdcdac5f095b1 Mon Sep 17 00:00:00 2001 From: barrierye Date: Thu, 30 Apr 2020 00:51:16 +0800 Subject: [PATCH] comment the warning in stub_imp.hpp --- core/general-client/src/general_model.cpp | 5 +++-- core/sdk-cpp/include/stub_impl.hpp | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/general-client/src/general_model.cpp b/core/general-client/src/general_model.cpp index 072524e2..e64cb174 100644 --- a/core/general-client/src/general_model.cpp +++ b/core/general-client/src/general_model.cpp @@ -119,7 +119,7 @@ int PredictorClient::create_predictor_by_desc(const std::string &sdk_desc) { LOG(ERROR) << "Predictor Creation Failed"; return -1; } - _api.thrd_initialize(); + // _api.thrd_initialize(); return 0; } @@ -130,7 +130,7 @@ int PredictorClient::create_predictor() { LOG(ERROR) << "Predictor Creation Failed"; return -1; } - _api.thrd_initialize(); + // _api.thrd_initialize(); return 0; } @@ -152,6 +152,7 @@ int PredictorClient::batch_predict( int fetch_name_num = fetch_name.size(); + _api.thrd_initialize(); std::string variant_tag; _predictor = _api.fetch_predictor("general_model", &variant_tag); predict_res_batch.set_variant_tag(variant_tag); diff --git a/core/sdk-cpp/include/stub_impl.hpp b/core/sdk-cpp/include/stub_impl.hpp index 756c1289..5f19c0ca 100644 --- a/core/sdk-cpp/include/stub_impl.hpp +++ b/core/sdk-cpp/include/stub_impl.hpp @@ -133,7 +133,10 @@ int StubImpl::initialize(const VariantInfo& var, template int StubImpl::thrd_initialize() { if (THREAD_GETSPECIFIC(_bthread_key) != NULL) { - LOG(WARNING) << "Already thread initialized for stub"; + // Because gPRC is uesd, this function may be called + // multiple times, so the warning will be commented out + // temporarily. See PR:#483 and PR:#500 for details. + // LOG(WARNING) << "Already thread initialized for stub"; return 0; } -- GitLab