提交 73cc4551 编写于 作者: W wangguibao

make install; LOG(FATAL)->LOG(ERROR)

Change-Id: I7ae7a94d8c6086f669c374ecbfcff590dc663bfd
上级 3a6ca326
...@@ -16,6 +16,7 @@ cmake_minimum_required(VERSION 3.0) ...@@ -16,6 +16,7 @@ cmake_minimum_required(VERSION 3.0)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(PADDLE_SERVING_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(PADDLE_SERVING_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(PADDLE_SERVING_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(PADDLE_SERVING_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
SET(PADDLE_SERVING_INSTALL_DIR ${CMAKE_BINARY_DIR}/output)
include(system) include(system)
...@@ -40,12 +41,6 @@ endif() ...@@ -40,12 +41,6 @@ endif()
set(THIRD_PARTY_PATH "${CMAKE_BINARY_DIR}/third_party" CACHE STRING set(THIRD_PARTY_PATH "${CMAKE_BINARY_DIR}/third_party" CACHE STRING
"A path setting third party libraries download & build directories.") "A path setting third party libraries download & build directories.")
set(FLUID_INSTALL_DIR "${CMAKE_BINARY_DIR}/fluid_install_dir" CACHE STRING
"A path setting fluid shared and static libraries")
set(FLUID_INFERENCE_INSTALL_DIR "${CMAKE_BINARY_DIR}/fluid_inference_install_dir" CACHE STRING
"A path setting fluid inference shared and static libraries")
set(THIRD_PARTY_BUILD_TYPE Release) set(THIRD_PARTY_BUILD_TYPE Release)
option(WITH_AVX "Compile PaddlePaddle with AVX intrinsics" ${AVX_FOUND}) option(WITH_AVX "Compile PaddlePaddle with AVX intrinsics" ${AVX_FOUND})
...@@ -99,3 +94,6 @@ add_subdirectory(predictor) ...@@ -99,3 +94,6 @@ add_subdirectory(predictor)
add_subdirectory(inferencer-fluid-cpu) add_subdirectory(inferencer-fluid-cpu)
add_subdirectory(serving) add_subdirectory(serving)
add_subdirectory(sdk-cpp) add_subdirectory(sdk-cpp)
...@@ -18,3 +18,8 @@ target_include_directories(test_configure PUBLIC ...@@ -18,3 +18,8 @@ target_include_directories(test_configure PUBLIC
${CMAKE_CURRENT_LIST_DIR}/include ${CMAKE_CURRENT_LIST_DIR}/include
) )
target_link_libraries(test_configure configure protobuf) target_link_libraries(test_configure configure protobuf)
install(TARGETS configure
ARCHIVE DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/lib
)
...@@ -7,3 +7,7 @@ target_include_directories(fluid_cpu_engine PUBLIC ...@@ -7,3 +7,7 @@ target_include_directories(fluid_cpu_engine PUBLIC
add_dependencies(fluid_cpu_engine pdserving paddle_fluid configure) add_dependencies(fluid_cpu_engine pdserving paddle_fluid configure)
target_link_libraries(fluid_cpu_engine pdserving -liomp5 -lmklml_intel -lpthread -lcrypto -lm -lrt -lssl -ldl -lz) target_link_libraries(fluid_cpu_engine pdserving -liomp5 -lmklml_intel -lpthread -lcrypto -lm -lrt -lssl -ldl -lz)
install(TARGETS fluid_cpu_engine
ARCHIVE DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/lib
)
...@@ -74,7 +74,7 @@ public: ...@@ -74,7 +74,7 @@ public:
virtual bool Run(const void* in_data, void* out_data) { virtual bool Run(const void* in_data, void* out_data) {
if (!_core->Run(*(std::vector<paddle::PaddleTensor>*)in_data, if (!_core->Run(*(std::vector<paddle::PaddleTensor>*)in_data,
(std::vector<paddle::PaddleTensor>*)out_data)) { (std::vector<paddle::PaddleTensor>*)out_data)) {
LOG(FATAL) << "Failed call Run with paddle predictor"; LOG(ERROR) << "Failed call Run with paddle predictor";
return false; return false;
} }
...@@ -85,13 +85,13 @@ public: ...@@ -85,13 +85,13 @@ public:
virtual int clone(void* origin_core) { virtual int clone(void* origin_core) {
if (origin_core == NULL) { if (origin_core == NULL) {
LOG(FATAL) << "origin paddle Predictor is null."; LOG(ERROR) << "origin paddle Predictor is null.";
return -1; return -1;
} }
paddle::PaddlePredictor* p_predictor = (paddle::PaddlePredictor*)origin_core; paddle::PaddlePredictor* p_predictor = (paddle::PaddlePredictor*)origin_core;
_core = p_predictor->Clone(); _core = p_predictor->Clone();
if (_core.get() == NULL) { if (_core.get() == NULL) {
LOG(FATAL) << "fail to clone paddle predictor: " << origin_core; LOG(ERROR) << "fail to clone paddle predictor: " << origin_core;
return -1; return -1;
} }
return 0; return 0;
...@@ -110,7 +110,7 @@ class FluidCpuAnalysisCore : public FluidFamilyCore { ...@@ -110,7 +110,7 @@ class FluidCpuAnalysisCore : public FluidFamilyCore {
public: public:
int create(const std::string& data_path) { int create(const std::string& data_path) {
if (access(data_path.c_str(), F_OK) == -1) { if (access(data_path.c_str(), F_OK) == -1) {
LOG(FATAL) << "create paddle predictor failed, path not exits: " LOG(ERROR) << "create paddle predictor failed, path not exits: "
<< data_path; << data_path;
return -1; return -1;
} }
...@@ -125,7 +125,7 @@ public: ...@@ -125,7 +125,7 @@ public:
_core = paddle::CreatePaddlePredictor< _core = paddle::CreatePaddlePredictor<
paddle::contrib::AnalysisConfig>(analysis_config); paddle::contrib::AnalysisConfig>(analysis_config);
if (NULL == _core.get()) { if (NULL == _core.get()) {
LOG(FATAL) << "create paddle predictor failed, path: " LOG(ERROR) << "create paddle predictor failed, path: "
<< data_path; << data_path;
return -1; return -1;
} }
...@@ -139,7 +139,7 @@ class FluidCpuNativeCore : public FluidFamilyCore { ...@@ -139,7 +139,7 @@ class FluidCpuNativeCore : public FluidFamilyCore {
public: public:
int create(const std::string& data_path) { int create(const std::string& data_path) {
if (access(data_path.c_str(), F_OK) == -1) { if (access(data_path.c_str(), F_OK) == -1) {
LOG(FATAL) << "create paddle predictor failed, path not exits: " LOG(ERROR) << "create paddle predictor failed, path not exits: "
<< data_path; << data_path;
return -1; return -1;
} }
...@@ -153,7 +153,7 @@ public: ...@@ -153,7 +153,7 @@ public:
_core = paddle::CreatePaddlePredictor< _core = paddle::CreatePaddlePredictor<
paddle::NativeConfig, paddle::PaddleEngineKind::kNative>(native_config); paddle::NativeConfig, paddle::PaddleEngineKind::kNative>(native_config);
if (NULL == _core.get()) { if (NULL == _core.get()) {
LOG(FATAL) << "create paddle predictor failed, path: " LOG(ERROR) << "create paddle predictor failed, path: "
<< data_path; << data_path;
return -1; return -1;
} }
...@@ -167,7 +167,7 @@ class FluidCpuAnalysisDirCore : public FluidFamilyCore { ...@@ -167,7 +167,7 @@ class FluidCpuAnalysisDirCore : public FluidFamilyCore {
public: public:
int create(const std::string& data_path) { int create(const std::string& data_path) {
if (access(data_path.c_str(), F_OK) == -1) { if (access(data_path.c_str(), F_OK) == -1) {
LOG(FATAL) << "create paddle predictor failed, path not exits: " LOG(ERROR) << "create paddle predictor failed, path not exits: "
<< data_path; << data_path;
return -1; return -1;
} }
...@@ -181,7 +181,7 @@ public: ...@@ -181,7 +181,7 @@ public:
_core = paddle::CreatePaddlePredictor< _core = paddle::CreatePaddlePredictor<
paddle::contrib::AnalysisConfig>(analysis_config); paddle::contrib::AnalysisConfig>(analysis_config);
if (NULL == _core.get()) { if (NULL == _core.get()) {
LOG(FATAL) << "create paddle predictor failed, path: " LOG(ERROR) << "create paddle predictor failed, path: "
<< data_path; << data_path;
return -1; return -1;
} }
...@@ -196,7 +196,7 @@ class FluidCpuNativeDirCore : public FluidFamilyCore { ...@@ -196,7 +196,7 @@ class FluidCpuNativeDirCore : public FluidFamilyCore {
public: public:
int create(const std::string& data_path) { int create(const std::string& data_path) {
if (access(data_path.c_str(), F_OK) == -1) { if (access(data_path.c_str(), F_OK) == -1) {
LOG(FATAL) << "create paddle predictor failed, path not exits: " LOG(ERROR) << "create paddle predictor failed, path not exits: "
<< data_path; << data_path;
return -1; return -1;
} }
...@@ -209,7 +209,7 @@ public: ...@@ -209,7 +209,7 @@ public:
_core = paddle::CreatePaddlePredictor< _core = paddle::CreatePaddlePredictor<
paddle::NativeConfig, paddle::PaddleEngineKind::kNative>(native_config); paddle::NativeConfig, paddle::PaddleEngineKind::kNative>(native_config);
if (NULL == _core.get()) { if (NULL == _core.get()) {
LOG(FATAL) << "create paddle predictor failed, path: " LOG(ERROR) << "create paddle predictor failed, path: "
<< data_path; << data_path;
return -1; return -1;
} }
...@@ -235,7 +235,7 @@ public: ...@@ -235,7 +235,7 @@ public:
_col = col; _col = col;
_params = (float*)malloc(_row * _col * sizeof(float)); _params = (float*)malloc(_row * _col * sizeof(float));
if (_params == NULL) { if (_params == NULL) {
LOG(FATAL) << "Load " << _file_name << " malloc error."; LOG(ERROR) << "Load " << _file_name << " malloc error.";
return -1; return -1;
} }
LOG(WARNING) << "Load parameter file[" << _file_name << "] success."; LOG(WARNING) << "Load parameter file[" << _file_name << "] success.";
...@@ -253,20 +253,20 @@ public: ...@@ -253,20 +253,20 @@ public:
int load() { int load() {
if (_params == NULL || _row <= 0 || _col <= 0) { if (_params == NULL || _row <= 0 || _col <= 0) {
LOG(FATAL) << "load parameter error [not inited]."; LOG(ERROR) << "load parameter error [not inited].";
return -1; return -1;
} }
FILE* fs = fopen(_file_name.c_str(), "rb"); FILE* fs = fopen(_file_name.c_str(), "rb");
if (fs == NULL) { if (fs == NULL) {
LOG(FATAL) << "load " << _file_name << " fopen error."; LOG(ERROR) << "load " << _file_name << " fopen error.";
return -1; return -1;
} }
static const uint32_t MODEL_FILE_HEAD_LEN = 16; static const uint32_t MODEL_FILE_HEAD_LEN = 16;
char head[MODEL_FILE_HEAD_LEN] = {0}; char head[MODEL_FILE_HEAD_LEN] = {0};
if (fread(head, 1, MODEL_FILE_HEAD_LEN, fs) != MODEL_FILE_HEAD_LEN) { if (fread(head, 1, MODEL_FILE_HEAD_LEN, fs) != MODEL_FILE_HEAD_LEN) {
destroy(); destroy();
LOG(FATAL) << "Load " << _file_name << " read head error."; LOG(ERROR) << "Load " << _file_name << " read head error.";
if (fs != NULL) { if (fs != NULL) {
fclose(fs); fclose(fs);
fs = NULL; fs = NULL;
...@@ -283,7 +283,7 @@ public: ...@@ -283,7 +283,7 @@ public:
LOG(INFO) << "load " << _file_name << " read ok."; LOG(INFO) << "load " << _file_name << " read ok.";
return 0; return 0;
} else { } else {
LOG(FATAL) << "load " << _file_name << " read error."; LOG(ERROR) << "load " << _file_name << " read error.";
destroy(); destroy();
if (fs != NULL) { if (fs != NULL) {
fclose(fs); fclose(fs);
...@@ -309,13 +309,13 @@ public: ...@@ -309,13 +309,13 @@ public:
float exp_max, float exp_min) { float exp_max, float exp_min) {
AutoLock lock(GlobalSigmoidCreateMutex::instance()); AutoLock lock(GlobalSigmoidCreateMutex::instance());
if (0 != _sigmoid_w.init(2, 1, sigmoid_w_file) || 0 != _sigmoid_w.load()) { if (0 != _sigmoid_w.init(2, 1, sigmoid_w_file) || 0 != _sigmoid_w.load()) {
LOG(FATAL) << "load params sigmoid_w failed."; LOG(ERROR) << "load params sigmoid_w failed.";
return -1; return -1;
} }
LOG(WARNING) << "load sigmoid_w [" << _sigmoid_w._params[0] LOG(WARNING) << "load sigmoid_w [" << _sigmoid_w._params[0]
<< "] [" << _sigmoid_w._params[1] << "]."; << "] [" << _sigmoid_w._params[1] << "].";
if (0 != _sigmoid_b.init(2, 1, sigmoid_b_file) || 0 != _sigmoid_b.load()) { if (0 != _sigmoid_b.init(2, 1, sigmoid_b_file) || 0 != _sigmoid_b.load()) {
LOG(FATAL) << "load params sigmoid_b failed."; LOG(ERROR) << "load params sigmoid_b failed.";
return -1; return -1;
} }
LOG(WARNING) << "load sigmoid_b [" << _sigmoid_b._params[0] LOG(WARNING) << "load sigmoid_b [" << _sigmoid_b._params[0]
...@@ -372,7 +372,7 @@ public: ...@@ -372,7 +372,7 @@ public:
std::string conf_file = model_path.substr(pos); std::string conf_file = model_path.substr(pos);
configure::SigmoidConf conf; configure::SigmoidConf conf;
if (configure::read_proto_conf(conf_path, conf_file, &conf) != 0) { if (configure::read_proto_conf(conf_path, conf_file, &conf) != 0) {
LOG(FATAL) << "failed load model path: " << model_path; LOG(ERROR) << "failed load model path: " << model_path;
return -1; return -1;
} }
...@@ -381,7 +381,7 @@ public: ...@@ -381,7 +381,7 @@ public:
std::string fluid_model_data_path = conf.dnn_model_path(); std::string fluid_model_data_path = conf.dnn_model_path();
int ret = load_fluid_model(fluid_model_data_path); int ret = load_fluid_model(fluid_model_data_path);
if (ret < 0) { if (ret < 0) {
LOG(FATAL) << "fail to load fluid model."; LOG(ERROR) << "fail to load fluid model.";
return -1; return -1;
} }
const char* sigmoid_w_file = conf.sigmoid_w_file().c_str(); const char* sigmoid_w_file = conf.sigmoid_w_file().c_str();
...@@ -393,7 +393,7 @@ public: ...@@ -393,7 +393,7 @@ public:
<< "], use count[" << _core->_sigmoid_core.use_count() << "]."; << "], use count[" << _core->_sigmoid_core.use_count() << "].";
ret = _core->_sigmoid_core->load(sigmoid_w_file, sigmoid_b_file, exp_max, exp_min); ret = _core->_sigmoid_core->load(sigmoid_w_file, sigmoid_b_file, exp_max, exp_min);
if (ret < 0) { if (ret < 0) {
LOG(FATAL) << "fail to load sigmoid model."; LOG(ERROR) << "fail to load sigmoid model.";
return -1; return -1;
} }
return 0; return 0;
...@@ -402,7 +402,7 @@ public: ...@@ -402,7 +402,7 @@ public:
virtual bool Run(const void* in_data, void* out_data) { virtual bool Run(const void* in_data, void* out_data) {
if (!_core->_fluid_core->Run(*(std::vector<paddle::PaddleTensor>*)in_data, if (!_core->_fluid_core->Run(*(std::vector<paddle::PaddleTensor>*)in_data,
(std::vector<paddle::PaddleTensor>*)out_data)) { (std::vector<paddle::PaddleTensor>*)out_data)) {
LOG(FATAL) << "Failed call Run with paddle predictor"; LOG(ERROR) << "Failed call Run with paddle predictor";
return false; return false;
} }
...@@ -411,12 +411,12 @@ public: ...@@ -411,12 +411,12 @@ public:
virtual int clone(SigmoidFluidModel* origin_core) { virtual int clone(SigmoidFluidModel* origin_core) {
if (origin_core == NULL) { if (origin_core == NULL) {
LOG(FATAL) << "origin paddle Predictor is null."; LOG(ERROR) << "origin paddle Predictor is null.";
return -1; return -1;
} }
_core = origin_core->Clone(); _core = origin_core->Clone();
if (_core.get() == NULL) { if (_core.get() == NULL) {
LOG(FATAL) << "fail to clone paddle predictor: " << origin_core; LOG(ERROR) << "fail to clone paddle predictor: " << origin_core;
return -1; return -1;
} }
LOG(INFO) << "clone sigmoid core[" << _core->_sigmoid_core.get() LOG(INFO) << "clone sigmoid core[" << _core->_sigmoid_core.get()
...@@ -442,7 +442,7 @@ class FluidCpuNativeDirWithSigmoidCore : public FluidCpuWithSigmoidCore { ...@@ -442,7 +442,7 @@ class FluidCpuNativeDirWithSigmoidCore : public FluidCpuWithSigmoidCore {
public: public:
int load_fluid_model(const std::string& data_path) { int load_fluid_model(const std::string& data_path) {
if (access(data_path.c_str(), F_OK) == -1) { if (access(data_path.c_str(), F_OK) == -1) {
LOG(FATAL) << "create paddle predictor failed, path not exits: " LOG(ERROR) << "create paddle predictor failed, path not exits: "
<< data_path; << data_path;
return -1; return -1;
} }
...@@ -455,7 +455,7 @@ public: ...@@ -455,7 +455,7 @@ public:
_core->_fluid_core = paddle::CreatePaddlePredictor< _core->_fluid_core = paddle::CreatePaddlePredictor<
paddle::NativeConfig, paddle::PaddleEngineKind::kNative>(native_config); paddle::NativeConfig, paddle::PaddleEngineKind::kNative>(native_config);
if (NULL == _core.get()) { if (NULL == _core.get()) {
LOG(FATAL) << "create paddle predictor failed, path: " LOG(ERROR) << "create paddle predictor failed, path: "
<< data_path; << data_path;
return -1; return -1;
} }
...@@ -470,7 +470,7 @@ class FluidCpuAnalysisDirWithSigmoidCore : public FluidCpuWithSigmoidCore { ...@@ -470,7 +470,7 @@ class FluidCpuAnalysisDirWithSigmoidCore : public FluidCpuWithSigmoidCore {
public: public:
int load_fluid_model(const std::string& data_path) { int load_fluid_model(const std::string& data_path) {
if (access(data_path.c_str(), F_OK) == -1) { if (access(data_path.c_str(), F_OK) == -1) {
LOG(FATAL) << "create paddle predictor failed, path not exits: " LOG(ERROR) << "create paddle predictor failed, path not exits: "
<< data_path; << data_path;
return -1; return -1;
} }
...@@ -484,7 +484,7 @@ public: ...@@ -484,7 +484,7 @@ public:
_core->_fluid_core = paddle::CreatePaddlePredictor< _core->_fluid_core = paddle::CreatePaddlePredictor<
paddle::contrib::AnalysisConfig>(analysis_config); paddle::contrib::AnalysisConfig>(analysis_config);
if (NULL == _core.get()) { if (NULL == _core.get()) {
LOG(FATAL) << "create paddle predictor failed, path: " LOG(ERROR) << "create paddle predictor failed, path: "
<< data_path; << data_path;
return -1; return -1;
} }
......
...@@ -61,3 +61,11 @@ target_include_directories(pdclient PUBLIC ...@@ -61,3 +61,11 @@ target_include_directories(pdclient PUBLIC
) )
target_link_libraries(pdclient protobuf boost brpc -lpthread -lcrypto -lm -lrt -lssl -ldl -lz) target_link_libraries(pdclient protobuf boost brpc -lpthread -lcrypto -lm -lrt -lssl -ldl -lz)
# install
install(TARGETS pdclient pdserving pdcodegen
RUNTIME DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/bin
ARCHIVE DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/lib
LIBRARY DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/so
)
...@@ -10,7 +10,7 @@ namespace predictor { ...@@ -10,7 +10,7 @@ namespace predictor {
#ifndef CATCH_ANY_AND_RET #ifndef CATCH_ANY_AND_RET
#define CATCH_ANY_AND_RET(errno) \ #define CATCH_ANY_AND_RET(errno) \
catch (...) { \ catch (...) { \
LOG(FATAL) << "exception catched"; \ LOG(ERROR) << "exception catched"; \
return errno; \ return errno; \
} }
#endif #endif
......
...@@ -111,23 +111,23 @@ public: ...@@ -111,23 +111,23 @@ public:
const InArrayT& in, OutArrayT& out, bool align) { const InArrayT& in, OutArrayT& out, bool align) {
if (align) { if (align) {
if (out.count() <= 0 || out.size() <= 0) { if (out.count() <= 0 || out.size() <= 0) {
LOG(FATAL) << "Out tensor is empty, when aligned"; LOG(ERROR) << "Out tensor is empty, when aligned";
return false; return false;
} }
if (out.size() != in.size()) { if (out.size() != in.size()) {
LOG(FATAL) << "In/Out tensor size not eq: " << out.size() << "!=" << in.size(); LOG(ERROR) << "In/Out tensor size not eq: " << out.size() << "!=" << in.size();
return false; return false;
} }
for (size_t fi = 0, shape0 = 0; fi < out.count(); ++fi) { for (size_t fi = 0, shape0 = 0; fi < out.count(); ++fi) {
if (!out[fi].valid()) { if (!out[fi].valid()) {
LOG(FATAL) << "Out[" << fi << "] tensor not valid"; LOG(ERROR) << "Out[" << fi << "] tensor not valid";
return false; return false;
} }
if (out.size() != out[fi].shape0()) { if (out.size() != out[fi].shape0()) {
LOG(FATAL) << "Shape0 not consistency, " << out.size() << "!=" << out[fi].shape0() << ", " << fi; LOG(ERROR) << "Shape0 not consistency, " << out.size() << "!=" << out[fi].shape0() << ", " << fi;
return false; return false;
} }
} }
...@@ -231,7 +231,7 @@ public: ...@@ -231,7 +231,7 @@ public:
void* data_buf void* data_buf
= MempoolWrapper::instance().malloc(tensor_byte); = MempoolWrapper::instance().malloc(tensor_byte);
if (!data_buf) { if (!data_buf) {
LOG(FATAL) << "Malloc failed, size: " << tensor_byte; LOG(ERROR) << "Malloc failed, size: " << tensor_byte;
return ; return ;
} }
...@@ -240,7 +240,7 @@ public: ...@@ -240,7 +240,7 @@ public:
TaskMetaT& tm = _tasks[ti]; TaskMetaT& tm = _tasks[ti];
size_t acc_byte = ins_byte * (tm.end - tm.begin); size_t acc_byte = ins_byte * (tm.end - tm.begin);
if (data_byte + acc_byte > tensor_byte) { if (data_byte + acc_byte > tensor_byte) {
LOG(FATAL) << "Invalid bytes: " << data_byte << " + " << acc_byte << " >= " << tensor_byte; LOG(ERROR) << "Invalid bytes: " << data_byte << " + " << acc_byte << " >= " << tensor_byte;
return ; return ;
} }
...@@ -252,7 +252,7 @@ public: ...@@ -252,7 +252,7 @@ public:
} }
if (data_byte != tensor_byte) { if (data_byte != tensor_byte) {
LOG(FATAL) << "Invalid tensor byte: " << data_byte << " != " << tensor_byte; LOG(ERROR) << "Invalid tensor byte: " << data_byte << " != " << tensor_byte;
return ; return ;
} }
...@@ -270,7 +270,7 @@ public: ...@@ -270,7 +270,7 @@ public:
void notify_tasks() { void notify_tasks() {
if (_batch_out.size() != _batch_in.size()) { if (_batch_out.size() != _batch_in.size()) {
LOG(FATAL) << "batch size not consistency: " << _batch_out.size() << " != " << _batch_in.size(); LOG(ERROR) << "batch size not consistency: " << _batch_out.size() << " != " << _batch_in.size();
return ; return ;
} }
......
...@@ -28,7 +28,7 @@ int TaskExecutor<TaskT>::start(uint32_t thread_num, uint32_t init_timeout_sec) { ...@@ -28,7 +28,7 @@ int TaskExecutor<TaskT>::start(uint32_t thread_num, uint32_t init_timeout_sec) {
} }
if (thread_num == 0) { if (thread_num == 0) {
LOG(FATAL) << "cannot init BSF with zero thread"; LOG(ERROR) << "cannot init BSF with zero thread";
return -1; return -1;
} }
...@@ -42,7 +42,7 @@ int TaskExecutor<TaskT>::start(uint32_t thread_num, uint32_t init_timeout_sec) { ...@@ -42,7 +42,7 @@ int TaskExecutor<TaskT>::start(uint32_t thread_num, uint32_t init_timeout_sec) {
int rc = THREAD_CREATE( int rc = THREAD_CREATE(
&contexts[i].tid, NULL, &TaskExecutor::thread_entry, &contexts[i]); &contexts[i].tid, NULL, &TaskExecutor::thread_entry, &contexts[i]);
if (rc != 0) { if (rc != 0) {
LOG(FATAL) << "failed to create BSF worker thread: index=" << i << ", rc=" << rc << ", errno=" << errno << ":" << strerror(errno); LOG(ERROR) << "failed to create BSF worker thread: index=" << i << ", rc=" << rc << ", errno=" << errno << ":" << strerror(errno);
return -1; return -1;
} }
...@@ -71,7 +71,7 @@ int TaskExecutor<TaskT>::start(uint32_t thread_num, uint32_t init_timeout_sec) { ...@@ -71,7 +71,7 @@ int TaskExecutor<TaskT>::start(uint32_t thread_num, uint32_t init_timeout_sec) {
} }
if (has_error) { if (has_error) {
LOG(FATAL) << "BSF thread init error"; LOG(ERROR) << "BSF thread init error";
return -1; return -1;
} }
...@@ -86,7 +86,7 @@ int TaskExecutor<TaskT>::start(uint32_t thread_num, uint32_t init_timeout_sec) { ...@@ -86,7 +86,7 @@ int TaskExecutor<TaskT>::start(uint32_t thread_num, uint32_t init_timeout_sec) {
init_timeout -= sleep_interval; init_timeout -= sleep_interval;
} }
LOG(FATAL) << "BSF thread init timed out"; LOG(ERROR) << "BSF thread init timed out";
return -1; return -1;
} }
...@@ -108,19 +108,19 @@ TaskHandler<TaskT> TaskExecutor<TaskT>::schedule( ...@@ -108,19 +108,19 @@ TaskHandler<TaskT> TaskExecutor<TaskT>::schedule(
const InArrayT& in, OutArrayT& out) { const InArrayT& in, OutArrayT& out) {
TaskT* task = butil::get_object<TaskT>(); TaskT* task = butil::get_object<TaskT>();
if (!task) { if (!task) {
LOG(FATAL) << "Failed get TaskT from object pool"; LOG(ERROR) << "Failed get TaskT from object pool";
return TaskHandler<TaskT>::valid_handle(); return TaskHandler<TaskT>::valid_handle();
} }
if (!BatchTasks<TaskT>::check_valid(in, out, _batch_align)) { if (!BatchTasks<TaskT>::check_valid(in, out, _batch_align)) {
LOG(FATAL) << "Invalid input & output"; LOG(ERROR) << "Invalid input & output";
return TaskHandler<TaskT>::valid_handle(); return TaskHandler<TaskT>::valid_handle();
} }
int fds[2]; int fds[2];
int rc = pipe(fds); int rc = pipe(fds);
if (rc != 0) { if (rc != 0) {
LOG(FATAL) << "call pipe() failed, errno=" << errno << ":" << strerror(errno); LOG(ERROR) << "call pipe() failed, errno=" << errno << ":" << strerror(errno);
return TaskHandler<TaskT>::valid_handle(); return TaskHandler<TaskT>::valid_handle();
} }
...@@ -149,7 +149,7 @@ bool TaskExecutor<TaskT>::fetch_batch(BatchTasks<TaskT>& batch) { ...@@ -149,7 +149,7 @@ bool TaskExecutor<TaskT>::fetch_batch(BatchTasks<TaskT>& batch) {
} }
if (_task_queue.empty()) { if (_task_queue.empty()) {
LOG(FATAL) << "invalid task queue!"; LOG(ERROR) << "invalid task queue!";
return false; return false;
} }
...@@ -169,7 +169,7 @@ template<typename TaskT> ...@@ -169,7 +169,7 @@ template<typename TaskT>
int TaskExecutor<TaskT>::work(ThreadContext<TaskT>* context) { int TaskExecutor<TaskT>::work(ThreadContext<TaskT>* context) {
if (_thread_init_fn != NULL) { if (_thread_init_fn != NULL) {
if (_thread_init_fn(context->user_thread_context) != 0) { if (_thread_init_fn(context->user_thread_context) != 0) {
LOG(FATAL) << "execute thread init thunk failed, BSF thread will exit"; LOG(ERROR) << "execute thread init thunk failed, BSF thread will exit";
context->init_status = -1; context->init_status = -1;
return -1; return -1;
} else { } else {
...@@ -181,7 +181,7 @@ int TaskExecutor<TaskT>::work(ThreadContext<TaskT>* context) { ...@@ -181,7 +181,7 @@ int TaskExecutor<TaskT>::work(ThreadContext<TaskT>* context) {
while (!_stop) { while (!_stop) {
if (_thread_reset_fn != NULL) { if (_thread_reset_fn != NULL) {
if (_thread_reset_fn(context->user_thread_context) != 0) { if (_thread_reset_fn(context->user_thread_context) != 0) {
LOG(FATAL) << "execute user thread reset failed"; LOG(ERROR) << "execute user thread reset failed";
} }
} }
...@@ -205,7 +205,7 @@ bool TaskManager<InItemT, OutItemT>::schedule(const InArrayT& in, ...@@ -205,7 +205,7 @@ bool TaskManager<InItemT, OutItemT>::schedule(const InArrayT& in,
_task_owned = handler; _task_owned = handler;
return true; return true;
} else { } else {
LOG(FATAL) << "failed to schedule task"; LOG(ERROR) << "failed to schedule task";
return false; return false;
} }
} }
......
...@@ -121,7 +121,7 @@ public: ...@@ -121,7 +121,7 @@ public:
void notify_tasks() { void notify_tasks() {
if (_batch_out.size() != _batch_in.size()) { if (_batch_out.size() != _batch_in.size()) {
LOG(FATAL) << "batch size not consistency: " << _batch_out.size() << " != " << _batch_in.size(); LOG(ERROR) << "batch size not consistency: " << _batch_out.size() << " != " << _batch_in.size();
return ; return ;
} }
...@@ -133,7 +133,7 @@ public: ...@@ -133,7 +133,7 @@ public:
for (size_t oi = begin; oi < end; ++oi, ++bi) { for (size_t oi = begin; oi < end; ++oi, ++bi) {
if (bi >= _batch_in.size()) { if (bi >= _batch_in.size()) {
LOG(FATAL) << "batch index overflow: " << bi << " > " <<_batch_in.size(); LOG(ERROR) << "batch index overflow: " << bi << " > " <<_batch_in.size();
return ; return ;
} }
(*task->out)[oi] = _batch_out[bi]; (*task->out)[oi] = _batch_out[bi];
......
...@@ -74,7 +74,7 @@ public: ...@@ -74,7 +74,7 @@ public:
int share_to_bus(Bus* bus) { int share_to_bus(Bus* bus) {
if (bus->regist(_op, this) != 0) { if (bus->regist(_op, this) != 0) {
LOG(FATAL) LOG(ERROR)
<< "Failed regist channel[" << _op << "Failed regist channel[" << _op
<< "] to bus!"; << "] to bus!";
return -1; return -1;
...@@ -128,7 +128,7 @@ public: ...@@ -128,7 +128,7 @@ public:
} }
google::protobuf::Message* message_impl(derived_from_message<false>) { google::protobuf::Message* message_impl(derived_from_message<false>) {
LOG(FATAL) << "Current type: " << typeid(T).name() LOG(ERROR) << "Current type: " << typeid(T).name()
<< " is not derived from protobuf."; << " is not derived from protobuf.";
return NULL; return NULL;
} }
...@@ -143,7 +143,7 @@ public: ...@@ -143,7 +143,7 @@ public:
} }
const google::protobuf::Message* message_impl(derived_from_message<false>) const { const google::protobuf::Message* message_impl(derived_from_message<false>) const {
LOG(FATAL) << "Current type: " << typeid(T).name() LOG(ERROR) << "Current type: " << typeid(T).name()
<< " is not derived from protobuf."; << " is not derived from protobuf.";
return NULL; return NULL;
} }
......
...@@ -34,7 +34,7 @@ int Dag::deinit() { ...@@ -34,7 +34,7 @@ int Dag::deinit() {
if (conf != NULL) { if (conf != NULL) {
Op* op = OpRepository::instance().get_op(node->type); Op* op = OpRepository::instance().get_op(node->type);
if (op == NULL) { if (op == NULL) {
LOG(FATAL) << "Failed to get_op, op type[" << node->type << "]"; LOG(ERROR) << "Failed to get_op, op type[" << node->type << "]";
return -1; return -1;
} }
op->delete_config(conf); op->delete_config(conf);
...@@ -89,7 +89,7 @@ EdgeMode Dag::parse_mode(std::string& mode) { ...@@ -89,7 +89,7 @@ EdgeMode Dag::parse_mode(std::string& mode) {
int Dag::init(const char* path, const char* file, const std::string& name) { int Dag::init(const char* path, const char* file, const std::string& name) {
comcfg::Configure conf; comcfg::Configure conf;
if (conf.load(path, file) != 0) { if (conf.load(path, file) != 0) {
LOG(FATAL) << "Failed load conf from" LOG(ERROR) << "Failed load conf from"
<< path << "/" << file << " in dag: " << path << "/" << file << " in dag: "
<< name; << name;
return ERR_INTERNAL_FAILURE; return ERR_INTERNAL_FAILURE;
...@@ -123,7 +123,7 @@ int Dag::init(const configure::Workflow& conf, const std::string& name) { ...@@ -123,7 +123,7 @@ int Dag::init(const configure::Workflow& conf, const std::string& name) {
} }
Op* op = OpRepository::instance().get_op(node->type); Op* op = OpRepository::instance().get_op(node->type);
if (op == NULL) { if (op == NULL) {
LOG(FATAL) << "Failed to get_op, op type[" << node->type << "]"; LOG(ERROR) << "Failed to get_op, op type[" << node->type << "]";
return ERR_INTERNAL_FAILURE; return ERR_INTERNAL_FAILURE;
} }
// node->conf could be NULL // node->conf could be NULL
...@@ -134,7 +134,7 @@ int Dag::init(const configure::Workflow& conf, const std::string& name) { ...@@ -134,7 +134,7 @@ int Dag::init(const configure::Workflow& conf, const std::string& name) {
} }
if (topo_sort() != 0) { if (topo_sort() != 0) {
LOG(FATAL) << "Topo sort dag[" << _dag_name << "] failed!"; LOG(ERROR) << "Topo sort dag[" << _dag_name << "] failed!";
return ERR_INTERNAL_FAILURE; return ERR_INTERNAL_FAILURE;
} }
...@@ -228,7 +228,7 @@ void Dag::regist_metric(const std::string& service_name) { ...@@ -228,7 +228,7 @@ void Dag::regist_metric(const std::string& service_name) {
OP_METRIC_PREFIX + service_name + NAME_DELIMITER + node->full_name); OP_METRIC_PREFIX + service_name + NAME_DELIMITER + node->full_name);
Op* op = OpRepository::instance().get_op(node->type); Op* op = OpRepository::instance().get_op(node->type);
if (op == NULL) { if (op == NULL) {
LOG(FATAL) << "Failed to get_op, op type[" << node->type << "]"; LOG(ERROR) << "Failed to get_op, op type[" << node->type << "]";
return; return;
} }
op->set_full_name(service_name + NAME_DELIMITER + node->full_name); op->set_full_name(service_name + NAME_DELIMITER + node->full_name);
......
...@@ -17,12 +17,12 @@ int DagView::init(Dag* dag, const std::string& service_name) { ...@@ -17,12 +17,12 @@ int DagView::init(Dag* dag, const std::string& service_name) {
for (uint32_t si = 0; si < stage_size; si++) { for (uint32_t si = 0; si < stage_size; si++) {
const DagStage* stage = dag->stage_by_index(si); const DagStage* stage = dag->stage_by_index(si);
if (stage == NULL) { if (stage == NULL) {
LOG(FATAL) << "Failed get stage by index:" << si; LOG(ERROR) << "Failed get stage by index:" << si;
return ERR_INTERNAL_FAILURE; return ERR_INTERNAL_FAILURE;
} }
ViewStage* vstage = butil::get_object<ViewStage>(); ViewStage* vstage = butil::get_object<ViewStage>();
if (vstage == NULL) { if (vstage == NULL) {
LOG(FATAL) LOG(ERROR)
<< "Failed get vstage from object pool" << "Failed get vstage from object pool"
<< "at:" << si; << "at:" << si;
return ERR_MEM_ALLOC_FAILURE; return ERR_MEM_ALLOC_FAILURE;
...@@ -34,13 +34,13 @@ int DagView::init(Dag* dag, const std::string& service_name) { ...@@ -34,13 +34,13 @@ int DagView::init(Dag* dag, const std::string& service_name) {
DagNode* node = stage->nodes[ni]; DagNode* node = stage->nodes[ni];
ViewNode* vnode = butil::get_object<ViewNode>(); ViewNode* vnode = butil::get_object<ViewNode>();
if (vnode == NULL) { if (vnode == NULL) {
LOG(FATAL) << "Failed get vnode at:" << ni; LOG(ERROR) << "Failed get vnode at:" << ni;
return ERR_MEM_ALLOC_FAILURE; return ERR_MEM_ALLOC_FAILURE;
} }
// factory type // factory type
Op* op = OpRepository::instance().get_op(node->type); Op* op = OpRepository::instance().get_op(node->type);
if (op == NULL) { if (op == NULL) {
LOG(FATAL) << "Failed get op with type:" LOG(ERROR) << "Failed get op with type:"
<< node->type; << node->type;
return ERR_INTERNAL_FAILURE; return ERR_INTERNAL_FAILURE;
} }
...@@ -91,7 +91,7 @@ int DagView::execute(butil::IOBufBuilder* debug_os) { ...@@ -91,7 +91,7 @@ int DagView::execute(butil::IOBufBuilder* debug_os) {
int errcode = execute_one_stage(_view[si], debug_os); int errcode = execute_one_stage(_view[si], debug_os);
TRACEPRINTF("finish to execute stage[%u]", si); TRACEPRINTF("finish to execute stage[%u]", si);
if (errcode < 0) { if (errcode < 0) {
LOG(FATAL) LOG(ERROR)
<< "failed execute stage[" << "failed execute stage["
<< _view[si]->debug(); << _view[si]->debug();
return errcode; return errcode;
...@@ -115,7 +115,7 @@ int DagView::execute_one_stage(ViewStage* vstage, ...@@ -115,7 +115,7 @@ int DagView::execute_one_stage(ViewStage* vstage,
int errcode = op->process(debug_os != NULL); int errcode = op->process(debug_os != NULL);
TRACEPRINTF("finish to execute op[%s]", op->name()); TRACEPRINTF("finish to execute op[%s]", op->name());
if (errcode < 0) { if (errcode < 0) {
LOG(FATAL) LOG(ERROR)
<< "Execute failed, Op:" << op->debug_string(); << "Execute failed, Op:" << op->debug_string();
return errcode; return errcode;
} }
...@@ -156,14 +156,14 @@ const Channel* DagView::get_response_channel() const { ...@@ -156,14 +156,14 @@ const Channel* DagView::get_response_channel() const {
// Caller obtains response channel from bus, and // Caller obtains response channel from bus, and
// writes it to rpc response(protbuf/json) // writes it to rpc response(protbuf/json)
if (_view.size() < 1) { if (_view.size() < 1) {
LOG(FATAL) << "invalid empty view stage!"; LOG(ERROR) << "invalid empty view stage!";
return NULL; return NULL;
} }
ViewStage* last_stage = _view[_view.size() - 1]; ViewStage* last_stage = _view[_view.size() - 1];
if (last_stage->nodes.size() != 1 if (last_stage->nodes.size() != 1
|| last_stage->nodes[0] == NULL) { || last_stage->nodes[0] == NULL) {
LOG(FATAL) << "Invalid last stage, size[" LOG(ERROR) << "Invalid last stage, size["
<< last_stage->nodes.size() << last_stage->nodes.size()
<< "] != 1"; << "] != 1";
return NULL; return NULL;
...@@ -171,7 +171,7 @@ const Channel* DagView::get_response_channel() const { ...@@ -171,7 +171,7 @@ const Channel* DagView::get_response_channel() const {
Op* last_op = last_stage->nodes[0]->op; Op* last_op = last_stage->nodes[0]->op;
if (last_op == NULL) { if (last_op == NULL) {
LOG(FATAL) << "Last op is NULL"; LOG(ERROR) << "Last op is NULL";
return NULL; return NULL;
} }
return last_op->mutable_channel(); return last_op->mutable_channel();
......
此差异已折叠。
...@@ -86,14 +86,14 @@ struct Tensor { ...@@ -86,14 +86,14 @@ struct Tensor {
bool valid() const { bool valid() const {
if (shape.empty()) { if (shape.empty()) {
if (data.data() || data.size()) { if (data.data() || data.size()) {
LOG(FATAL) << "data should be empty"; LOG(ERROR) << "data should be empty";
return false; return false;
} }
return true; return true;
} }
if (!data.data() || !data.size()) { if (!data.data() || !data.size()) {
LOG(FATAL) << "data cannot empty"; LOG(ERROR) << "data cannot empty";
return false; return false;
} }
...@@ -103,7 +103,7 @@ struct Tensor { ...@@ -103,7 +103,7 @@ struct Tensor {
} }
if (byte_size * ele_byte() != data.size()) { if (byte_size * ele_byte() != data.size()) {
LOG(FATAL) << "wrong data size: " << byte_size * ele_byte() << " vs. " << data.size(); LOG(ERROR) << "wrong data size: " << byte_size * ele_byte() << " vs. " << data.size();
return false; return false;
} }
......
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
int initialize(const std::string path, const std::string file) { int initialize(const std::string path, const std::string file) {
WorkflowConf workflow_conf; WorkflowConf workflow_conf;
if (configure::read_proto_conf(path, file, &workflow_conf) != 0) { if (configure::read_proto_conf(path, file, &workflow_conf) != 0) {
LOG(FATAL) << "Failed load manager<" << Workflow::tag() << "> configure from " << path << "/" << file; LOG(ERROR) << "Failed load manager<" << Workflow::tag() << "> configure from " << path << "/" << file;
return -1; return -1;
} }
...@@ -52,11 +52,11 @@ public: ...@@ -52,11 +52,11 @@ public:
std::string name = workflow_conf.workflows(ii).name(); std::string name = workflow_conf.workflows(ii).name();
Workflow* item = new (std::nothrow) Workflow(); Workflow* item = new (std::nothrow) Workflow();
if (item == NULL) { if (item == NULL) {
LOG(FATAL) << "Failed create " << Workflow::tag() << " for: " << name; LOG(ERROR) << "Failed create " << Workflow::tag() << " for: " << name;
return -1; return -1;
} }
if (item->init(workflow_conf.workflows(ii)) != 0) { if (item->init(workflow_conf.workflows(ii)) != 0) {
LOG(FATAL) LOG(ERROR)
<< "Failed init item: " << name << " at:" << "Failed init item: " << name << " at:"
<< ii << "!"; << ii << "!";
return -1; return -1;
...@@ -66,7 +66,7 @@ public: ...@@ -66,7 +66,7 @@ public:
typename boost::unordered_map<std::string, Workflow*>::iterator, bool> typename boost::unordered_map<std::string, Workflow*>::iterator, bool>
r = _item_map.insert(std::make_pair(name, item)); r = _item_map.insert(std::make_pair(name, item));
if (!r.second) { if (!r.second) {
LOG(FATAL) LOG(ERROR)
<< "Failed insert item:" << name << " at:" << "Failed insert item:" << name << " at:"
<< ii << "!"; << ii << "!";
return -1; return -1;
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
} }
} catch (...) { } catch (...) {
LOG(FATAL) LOG(ERROR)
<< "Config[" << path << "/" << file << "] format " << "Config[" << path << "/" << file << "] format "
<< "invalid, load failed"; << "invalid, load failed";
return -1; return -1;
...@@ -149,7 +149,7 @@ public: ...@@ -149,7 +149,7 @@ public:
int initialize(const std::string path, const std::string file) { int initialize(const std::string path, const std::string file) {
InferServiceConf infer_service_conf; InferServiceConf infer_service_conf;
if (configure::read_proto_conf(path, file, &infer_service_conf) != 0) { if (configure::read_proto_conf(path, file, &infer_service_conf) != 0) {
LOG(FATAL) << "Failed load manager<" << InferService::tag() << "> configure!"; LOG(ERROR) << "Failed load manager<" << InferService::tag() << "> configure!";
return -1; return -1;
} }
...@@ -160,11 +160,11 @@ public: ...@@ -160,11 +160,11 @@ public:
std::string name = infer_service_conf.services(ii).name(); std::string name = infer_service_conf.services(ii).name();
InferService* item = new (std::nothrow) InferService(); InferService* item = new (std::nothrow) InferService();
if (item == NULL) { if (item == NULL) {
LOG(FATAL) << "Failed create " << InferService::tag() << " for: " << name; LOG(ERROR) << "Failed create " << InferService::tag() << " for: " << name;
return -1; return -1;
} }
if (item->init(infer_service_conf.services(ii)) != 0) { if (item->init(infer_service_conf.services(ii)) != 0) {
LOG(FATAL) LOG(ERROR)
<< "Failed init item: " << name << " at:" << "Failed init item: " << name << " at:"
<< ii << "!"; << ii << "!";
return -1; return -1;
...@@ -174,7 +174,7 @@ public: ...@@ -174,7 +174,7 @@ public:
typename boost::unordered_map<std::string, InferService*>::iterator, bool> typename boost::unordered_map<std::string, InferService*>::iterator, bool>
r = _item_map.insert(std::make_pair(name, item)); r = _item_map.insert(std::make_pair(name, item));
if (!r.second) { if (!r.second) {
LOG(FATAL) LOG(ERROR)
<< "Failed insert item:" << name << " at:" << "Failed insert item:" << name << " at:"
<< ii << "!"; << ii << "!";
return -1; return -1;
...@@ -186,7 +186,7 @@ public: ...@@ -186,7 +186,7 @@ public:
} }
} catch (...) { } catch (...) {
LOG(FATAL) LOG(ERROR)
<< "Config[" << path << "/" << file << "] format " << "Config[" << path << "/" << file << "] format "
<< "invalid, load failed"; << "invalid, load failed";
return -1; return -1;
......
...@@ -11,35 +11,35 @@ Op* OpRepository::get_op(std::string op_type) { ...@@ -11,35 +11,35 @@ Op* OpRepository::get_op(std::string op_type) {
if (iter != _repository.end()) { if (iter != _repository.end()) {
op = (iter->second)->get_op(); op = (iter->second)->get_op();
} else { } else {
LOG(FATAL) << "Try to create unknown op[" << op_type << "]"; LOG(ERROR) << "Try to create unknown op[" << op_type << "]";
} }
return op; return op;
} }
void OpRepository::return_op(Op* op) { void OpRepository::return_op(Op* op) {
if (op == NULL) { if (op == NULL) {
LOG(FATAL) << "Try to return NULL op"; LOG(ERROR) << "Try to return NULL op";
return; return;
} }
ManagerMap::iterator iter = _repository.find(op->type()); ManagerMap::iterator iter = _repository.find(op->type());
if (iter != _repository.end()) { if (iter != _repository.end()) {
iter->second->return_op(op); iter->second->return_op(op);
} else { } else {
LOG(FATAL) << "Try to return unknown op[" << op << "], op_type[" LOG(ERROR) << "Try to return unknown op[" << op << "], op_type["
<< op->type() << "]."; << op->type() << "].";
} }
} }
void OpRepository::return_op(const std::string& op_type, Op* op) { void OpRepository::return_op(const std::string& op_type, Op* op) {
if (op == NULL) { if (op == NULL) {
LOG(FATAL) << "Try to return NULL op"; LOG(ERROR) << "Try to return NULL op";
return; return;
} }
ManagerMap::iterator iter = _repository.find(op_type); ManagerMap::iterator iter = _repository.find(op_type);
if (iter != _repository.end()) { if (iter != _repository.end()) {
iter->second->return_op(op); iter->second->return_op(op);
} else { } else {
LOG(FATAL) << "Try to return unknown op[" << op << "], op_type[" LOG(ERROR) << "Try to return unknown op[" << op << "], op_type["
<< op_type << "]."; << op_type << "].";
} }
} }
......
...@@ -210,7 +210,7 @@ public: ...@@ -210,7 +210,7 @@ public:
if (metric != NULL) { if (metric != NULL) {
**metric << latency; **metric << latency;
} else { } else {
LOG(FATAL) << "impossible, check if you regist[" << metric_name << "]."; LOG(ERROR) << "impossible, check if you regist[" << metric_name << "].";
} }
} }
...@@ -219,7 +219,7 @@ public: ...@@ -219,7 +219,7 @@ public:
if (metric != NULL) { if (metric != NULL) {
**metric << count; **metric << count;
} else { } else {
LOG(FATAL) << "impossible, check if you regist[" << metric_name << "]."; LOG(ERROR) << "impossible, check if you regist[" << metric_name << "].";
} }
} }
...@@ -228,7 +228,7 @@ public: ...@@ -228,7 +228,7 @@ public:
if (metric != NULL) { if (metric != NULL) {
**metric << value; **metric << value;
} else { } else {
LOG(FATAL) << "impossible, check if you regist[" << metric_name << "]."; LOG(ERROR) << "impossible, check if you regist[" << metric_name << "].";
} }
} }
...@@ -237,7 +237,7 @@ public: ...@@ -237,7 +237,7 @@ public:
if (metric != NULL) { if (metric != NULL) {
**metric << value; **metric << value;
} else { } else {
LOG(FATAL) << "impossible, check if you regist[" << metric_name << "]."; LOG(ERROR) << "impossible, check if you regist[" << metric_name << "].";
} }
} }
...@@ -246,7 +246,7 @@ public: ...@@ -246,7 +246,7 @@ public:
if (metric != NULL) { if (metric != NULL) {
(*metric)->update_lhs(count); (*metric)->update_lhs(count);
} else { } else {
LOG(FATAL) << "impossible, check if you regist[" << name << "]."; LOG(ERROR) << "impossible, check if you regist[" << name << "].";
} }
} }
...@@ -255,7 +255,7 @@ public: ...@@ -255,7 +255,7 @@ public:
if (metric != NULL) { if (metric != NULL) {
(*metric)->update_rhs(count); (*metric)->update_rhs(count);
} else { } else {
LOG(FATAL) << "impossible, check if you regist[" << name << "]."; LOG(ERROR) << "impossible, check if you regist[" << name << "].";
} }
} }
......
...@@ -84,7 +84,7 @@ int Resource::thread_initialize() { ...@@ -84,7 +84,7 @@ int Resource::thread_initialize() {
// infer manager // infer manager
if (FLAGS_enable_model_toolkit && InferManager::instance().thrd_initialize() != 0) { if (FLAGS_enable_model_toolkit && InferManager::instance().thrd_initialize() != 0) {
LOG(FATAL) << "Failed thrd initialized infer manager"; LOG(ERROR) << "Failed thrd initialized infer manager";
return -1; return -1;
} }
...@@ -92,18 +92,18 @@ int Resource::thread_initialize() { ...@@ -92,18 +92,18 @@ int Resource::thread_initialize() {
if (p_dynamic_resource == NULL) { if (p_dynamic_resource == NULL) {
p_dynamic_resource = new (std::nothrow) DynamicResource; p_dynamic_resource = new (std::nothrow) DynamicResource;
if (p_dynamic_resource == NULL) { if (p_dynamic_resource == NULL) {
LOG(FATAL) << "failed to create tls DynamicResource"; LOG(ERROR) << "failed to create tls DynamicResource";
return -1; return -1;
} }
if (p_dynamic_resource->initialize() != 0) { if (p_dynamic_resource->initialize() != 0) {
LOG(FATAL) << "DynamicResource initialize failed."; LOG(ERROR) << "DynamicResource initialize failed.";
delete p_dynamic_resource; delete p_dynamic_resource;
p_dynamic_resource = NULL; p_dynamic_resource = NULL;
return -1; return -1;
} }
if (THREAD_SETSPECIFIC(_tls_bspec_key, p_dynamic_resource) != 0) { if (THREAD_SETSPECIFIC(_tls_bspec_key, p_dynamic_resource) != 0) {
LOG(FATAL) << "unable to set tls DynamicResource"; LOG(ERROR) << "unable to set tls DynamicResource";
delete p_dynamic_resource; delete p_dynamic_resource;
p_dynamic_resource = NULL; p_dynamic_resource = NULL;
return -1; return -1;
...@@ -128,21 +128,21 @@ int Resource::thread_clear() { ...@@ -128,21 +128,21 @@ int Resource::thread_clear() {
// infer manager // infer manager
if (FLAGS_enable_model_toolkit && InferManager::instance().thrd_clear() != 0) { if (FLAGS_enable_model_toolkit && InferManager::instance().thrd_clear() != 0) {
LOG(FATAL) << "Failed thrd clear infer manager"; LOG(ERROR) << "Failed thrd clear infer manager";
return -1; return -1;
} }
DynamicResource* p_dynamic_resource = (DynamicResource*) THREAD_GETSPECIFIC(_tls_bspec_key); DynamicResource* p_dynamic_resource = (DynamicResource*) THREAD_GETSPECIFIC(_tls_bspec_key);
if (p_dynamic_resource == NULL) { if (p_dynamic_resource == NULL) {
#if 0 #if 0
LOG(FATAL) << "tls dynamic resource shouldn't be null after thread_initialize"; LOG(ERROR) << "tls dynamic resource shouldn't be null after thread_initialize";
#else #else
LOG(FATAL) << bthread_self() << ": tls dynamic resource shouldn't be null after thread_initialize"; LOG(ERROR) << bthread_self() << ": tls dynamic resource shouldn't be null after thread_initialize";
#endif #endif
return -1; return -1;
} }
if (p_dynamic_resource->clear() != 0) { if (p_dynamic_resource->clear() != 0) {
LOG(FATAL) << "Failed to invoke dynamic resource clear"; LOG(ERROR) << "Failed to invoke dynamic resource clear";
return -1; return -1;
} }
...@@ -153,7 +153,7 @@ int Resource::thread_clear() { ...@@ -153,7 +153,7 @@ int Resource::thread_clear() {
int Resource::reload() { int Resource::reload() {
if (FLAGS_enable_model_toolkit && InferManager::instance().reload() != 0) { if (FLAGS_enable_model_toolkit && InferManager::instance().reload() != 0) {
LOG(FATAL) << "Failed reload infer manager"; LOG(ERROR) << "Failed reload infer manager";
return -1; return -1;
} }
...@@ -163,7 +163,7 @@ int Resource::reload() { ...@@ -163,7 +163,7 @@ int Resource::reload() {
int Resource::finalize() { int Resource::finalize() {
if (FLAGS_enable_model_toolkit && InferManager::instance().proc_finalize() != 0) { if (FLAGS_enable_model_toolkit && InferManager::instance().proc_finalize() != 0) {
LOG(FATAL) << "Failed proc finalize infer manager"; LOG(ERROR) << "Failed proc finalize infer manager";
return -1; return -1;
} }
......
...@@ -32,12 +32,12 @@ int ServerManager::add_service_by_format(const std::string& format) { ...@@ -32,12 +32,12 @@ int ServerManager::add_service_by_format(const std::string& format) {
Service* service = Service* service =
FormatServiceManager::instance().get_service(format); FormatServiceManager::instance().get_service(format);
if (service == NULL) { if (service == NULL) {
LOG(FATAL) << "Not found service by format:" << format << "!"; LOG(ERROR) << "Not found service by format:" << format << "!";
return -1; return -1;
} }
if (_format_services.find(format) != _format_services.end()) { if (_format_services.find(format) != _format_services.end()) {
LOG(FATAL) << "Cannot insert duplicated service by format:" LOG(ERROR) << "Cannot insert duplicated service by format:"
<< format << "!"; << format << "!";
return -1; return -1;
} }
...@@ -45,7 +45,7 @@ int ServerManager::add_service_by_format(const std::string& format) { ...@@ -45,7 +45,7 @@ int ServerManager::add_service_by_format(const std::string& format) {
std::pair<boost::unordered_map<std::string, Service*>::iterator, bool> it std::pair<boost::unordered_map<std::string, Service*>::iterator, bool> it
= _format_services.insert(std::make_pair(format, service)); = _format_services.insert(std::make_pair(format, service));
if (!it.second) { if (!it.second) {
LOG(FATAL) << "Failed insert service by format:" LOG(ERROR) << "Failed insert service by format:"
<< format << "!"; << format << "!";
return -1; return -1;
} }
...@@ -126,11 +126,11 @@ void* ServerManager::_reload_worker(void* args) { ...@@ -126,11 +126,11 @@ void* ServerManager::_reload_worker(void* args) {
while (ServerManager::reload_starting()) { while (ServerManager::reload_starting()) {
LOG(INFO) << "Begin reload framework..."; LOG(INFO) << "Begin reload framework...";
if (Resource::instance().reload() != 0) { if (Resource::instance().reload() != 0) {
LOG(FATAL) << "Failed reload resource!"; LOG(ERROR) << "Failed reload resource!";
} }
if (WorkflowManager::instance().reload() != 0) { if (WorkflowManager::instance().reload() != 0) {
LOG(FATAL) << "Failed reload workflows"; LOG(ERROR) << "Failed reload workflows";
} }
usleep(FLAGS_reload_interval_s * 1000000); usleep(FLAGS_reload_interval_s * 1000000);
......
...@@ -30,7 +30,7 @@ int InferService::init(const configure::InferService& conf) { ...@@ -30,7 +30,7 @@ int InferService::init(const configure::InferService& conf) {
ServerManager& svr_mgr = ServerManager::instance(); ServerManager& svr_mgr = ServerManager::instance();
if (svr_mgr.add_service_by_format(_infer_service_format) != 0) { if (svr_mgr.add_service_by_format(_infer_service_format) != 0) {
LOG(FATAL) LOG(ERROR)
<< "Not found service by format name:" << "Not found service by format name:"
<< _infer_service_format << "!"; << _infer_service_format << "!";
return ERR_INTERNAL_FAILURE; return ERR_INTERNAL_FAILURE;
...@@ -44,7 +44,7 @@ int InferService::init(const configure::InferService& conf) { ...@@ -44,7 +44,7 @@ int InferService::init(const configure::InferService& conf) {
if (_enable_map_request_to_workflow) { if (_enable_map_request_to_workflow) {
if (_request_to_workflow_map.init( if (_request_to_workflow_map.init(
MAX_WORKFLOW_NUM_IN_ONE_SERVICE/*load_factor=80*/) != 0) { MAX_WORKFLOW_NUM_IN_ONE_SERVICE/*load_factor=80*/) != 0) {
LOG(FATAL) LOG(ERROR)
<< "init request to workflow map failed, bucket_count[" << "init request to workflow map failed, bucket_count["
<< MAX_WORKFLOW_NUM_IN_ONE_SERVICE << "]."; << MAX_WORKFLOW_NUM_IN_ONE_SERVICE << "].";
return ERR_INTERNAL_FAILURE; return ERR_INTERNAL_FAILURE;
...@@ -52,7 +52,7 @@ int InferService::init(const configure::InferService& conf) { ...@@ -52,7 +52,7 @@ int InferService::init(const configure::InferService& conf) {
int err = 0; int err = 0;
_request_field_key = conf.request_field_key().c_str(); _request_field_key = conf.request_field_key().c_str();
if (_request_field_key == "") { if (_request_field_key == "") {
LOG(FATAL) LOG(ERROR)
<< "read request_field_key failed, request_field_key[" << "read request_field_key failed, request_field_key["
<< _request_field_key << "]."; << _request_field_key << "].";
return ERR_INTERNAL_FAILURE; return ERR_INTERNAL_FAILURE;
...@@ -74,7 +74,7 @@ int InferService::init(const configure::InferService& conf) { ...@@ -74,7 +74,7 @@ int InferService::init(const configure::InferService& conf) {
Workflow* workflow = Workflow* workflow =
WorkflowManager::instance().item(tokens[ti]); WorkflowManager::instance().item(tokens[ti]);
if (workflow == NULL) { if (workflow == NULL) {
LOG(FATAL) LOG(ERROR)
<< "Failed get workflow by name:" << "Failed get workflow by name:"
<< tokens[ti] << ", ti: " << ti; << tokens[ti] << ", ti: " << ti;
return ERR_INTERNAL_FAILURE; return ERR_INTERNAL_FAILURE;
...@@ -85,7 +85,7 @@ int InferService::init(const configure::InferService& conf) { ...@@ -85,7 +85,7 @@ int InferService::init(const configure::InferService& conf) {
const std::string& request_field_value = conf.value_mapped_workflows(fi).request_field_value(); const std::string& request_field_value = conf.value_mapped_workflows(fi).request_field_value();
if (_request_to_workflow_map.insert(request_field_value, workflows) == NULL) { if (_request_to_workflow_map.insert(request_field_value, workflows) == NULL) {
LOG(FATAL) LOG(ERROR)
<< "insert [" << request_field_value << "," << "insert [" << request_field_value << ","
<< list << "] to _request_to_workflow_map failed."; << list << "] to _request_to_workflow_map failed.";
return ERR_INTERNAL_FAILURE; return ERR_INTERNAL_FAILURE;
...@@ -100,7 +100,7 @@ int InferService::init(const configure::InferService& conf) { ...@@ -100,7 +100,7 @@ int InferService::init(const configure::InferService& conf) {
Workflow* workflow = Workflow* workflow =
WorkflowManager::instance().item(workflow_name); WorkflowManager::instance().item(workflow_name);
if (workflow == NULL) { if (workflow == NULL) {
LOG(FATAL) LOG(ERROR)
<< "Failed get workflow by name:" << "Failed get workflow by name:"
<< workflow_name; << workflow_name;
return ERR_INTERNAL_FAILURE; return ERR_INTERNAL_FAILURE;
...@@ -158,7 +158,7 @@ int InferService::inference( ...@@ -158,7 +158,7 @@ int InferService::inference(
int errcode = _execute_workflow(workflow, request, response, debug_os); int errcode = _execute_workflow(workflow, request, response, debug_os);
TRACEPRINTF("finish to execute workflow[%s]", workflow->name().c_str()); TRACEPRINTF("finish to execute workflow[%s]", workflow->name().c_str());
if (errcode < 0) { if (errcode < 0) {
LOG(FATAL) << "Failed execute workflow[" << workflow->name() LOG(ERROR) << "Failed execute workflow[" << workflow->name()
<< "] in:" << name(); << "] in:" << name();
return errcode; return errcode;
} }
...@@ -171,7 +171,7 @@ int InferService::inference( ...@@ -171,7 +171,7 @@ int InferService::inference(
int errcode = execute_one_workflow(fi, request, response, debug_os); int errcode = execute_one_workflow(fi, request, response, debug_os);
TRACEPRINTF("finish to execute one workflow-%lu", fi); TRACEPRINTF("finish to execute one workflow-%lu", fi);
if (errcode < 0) { if (errcode < 0) {
LOG(FATAL) << "Failed execute 0-th workflow in:" << name(); LOG(ERROR) << "Failed execute 0-th workflow in:" << name();
return errcode; return errcode;
} }
} }
...@@ -192,7 +192,7 @@ int InferService::execute_one_workflow( ...@@ -192,7 +192,7 @@ int InferService::execute_one_workflow(
google::protobuf::Message* response, google::protobuf::Message* response,
butil::IOBufBuilder* debug_os) { butil::IOBufBuilder* debug_os) {
if (index >= _flows.size()) { if (index >= _flows.size()) {
LOG(FATAL) << "Faield execute workflow, index: " LOG(ERROR) << "Faield execute workflow, index: "
<< index << " >= max:" << _flows.size(); << index << " >= max:" << _flows.size();
return ERR_OVERFLOW_FAILURE; return ERR_OVERFLOW_FAILURE;
} }
...@@ -217,7 +217,7 @@ int InferService::_execute_workflow( ...@@ -217,7 +217,7 @@ int InferService::_execute_workflow(
// call actual inference interface // call actual inference interface
int errcode = dv->execute(debug_os); int errcode = dv->execute(debug_os);
if (errcode < 0) { if (errcode < 0) {
LOG(FATAL) << "Failed execute dag for workflow:" LOG(ERROR) << "Failed execute dag for workflow:"
<< workflow->name(); << workflow->name();
return errcode; return errcode;
} }
...@@ -226,7 +226,7 @@ int InferService::_execute_workflow( ...@@ -226,7 +226,7 @@ int InferService::_execute_workflow(
// create ender channel and copy // create ender channel and copy
const Channel* res_channel = dv->get_response_channel(); const Channel* res_channel = dv->get_response_channel();
if (!_merger || !_merger->merge(res_channel->message(), response)) { if (!_merger || !_merger->merge(res_channel->message(), response)) {
LOG(FATAL) << "Failed merge channel res to response"; LOG(ERROR) << "Failed merge channel res to response";
return ERR_INTERNAL_FAILURE; return ERR_INTERNAL_FAILURE;
} }
TRACEPRINTF("finish to copy from"); TRACEPRINTF("finish to copy from");
......
...@@ -12,7 +12,7 @@ do { \ ...@@ -12,7 +12,7 @@ do { \
int ret = ::baidu::paddle_serving::predictor::FormatServiceManager::instance().regist_service(\ int ret = ::baidu::paddle_serving::predictor::FormatServiceManager::instance().regist_service(\
svr_name, svr); \ svr_name, svr); \
if (ret != 0) { \ if (ret != 0) { \
LOG(FATAL) \ LOG(ERROR) \
<< "Failed regist service[" \ << "Failed regist service[" \
<< svr_name << "]" << "[" \ << svr_name << "]" << "[" \
<< typeid(svr).name() << "]" \ << typeid(svr).name() << "]" \
...@@ -32,7 +32,7 @@ public: ...@@ -32,7 +32,7 @@ public:
int regist_service(const std::string& svr_name, Service* svr) { int regist_service(const std::string& svr_name, Service* svr) {
if (_service_map.find(svr_name) != _service_map.end()) { if (_service_map.find(svr_name) != _service_map.end()) {
LOG(FATAL) LOG(ERROR)
<< "Service[" << svr_name << "][" << "Service[" << svr_name << "]["
<< typeid(svr).name() << "]" << typeid(svr).name() << "]"
<< " already exist!"; << " already exist!";
...@@ -42,7 +42,7 @@ public: ...@@ -42,7 +42,7 @@ public:
std::pair<boost::unordered_map<std::string, Service*>::iterator, bool> ret; std::pair<boost::unordered_map<std::string, Service*>::iterator, bool> ret;
ret = _service_map.insert(std::make_pair(svr_name, svr)); ret = _service_map.insert(std::make_pair(svr_name, svr));
if (ret.second == false) { if (ret.second == false) {
LOG(FATAL) LOG(ERROR)
<< "Service[" << svr_name << "][" << "Service[" << svr_name << "]["
<< typeid(svr).name() << "]" << typeid(svr).name() << "]"
<< " insert failed!"; << " insert failed!";
......
...@@ -24,12 +24,12 @@ DagView* Workflow::fetch_dag_view(const std::string& service_name) { ...@@ -24,12 +24,12 @@ DagView* Workflow::fetch_dag_view(const std::string& service_name) {
} else if (_type == "Parallel") { } else if (_type == "Parallel") {
view = butil::get_object<ParallelDagView>(); view = butil::get_object<ParallelDagView>();
} else { } else {
LOG(FATAL) LOG(ERROR)
<< "Unknown dag type:" << _type << "!"; << "Unknown dag type:" << _type << "!";
return NULL; return NULL;
} }
if (view == NULL) { if (view == NULL) {
LOG(FATAL) << "create dag view from pool failed!"; LOG(ERROR) << "create dag view from pool failed!";
return NULL; return NULL;
} }
view->init(&_dag, service_name); view->init(&_dag, service_name);
...@@ -44,7 +44,7 @@ void Workflow::return_dag_view(DagView* view) { ...@@ -44,7 +44,7 @@ void Workflow::return_dag_view(DagView* view) {
butil::return_object<ParallelDagView>( butil::return_object<ParallelDagView>(
dynamic_cast<ParallelDagView*>(view)); dynamic_cast<ParallelDagView*>(view));
} else { } else {
LOG(FATAL) LOG(ERROR)
<< "Unknown dag type:" << _type << "!"; << "Unknown dag type:" << _type << "!";
return ; return ;
} }
......
...@@ -20,7 +20,7 @@ int Op::init(Bus* bus, Dag* dag, uint32_t id, const std::string& name, ...@@ -20,7 +20,7 @@ int Op::init(Bus* bus, Dag* dag, uint32_t id, const std::string& name,
_timer = butil::get_object<TimerFlow>(); _timer = butil::get_object<TimerFlow>();
if (!_timer) { if (!_timer) {
LOG(FATAL) << "Invalid timerflow in op:" LOG(ERROR) << "Invalid timerflow in op:"
<< this->name(); << this->name();
return -1; return -1;
} }
...@@ -31,7 +31,7 @@ int Op::init(Bus* bus, Dag* dag, uint32_t id, const std::string& name, ...@@ -31,7 +31,7 @@ int Op::init(Bus* bus, Dag* dag, uint32_t id, const std::string& name,
Channel* channel = mutable_channel(); Channel* channel = mutable_channel();
if (channel == NULL) { if (channel == NULL) {
LOG(FATAL) LOG(ERROR)
<< "Failed mutable channel in op: " << "Failed mutable channel in op: "
<< this->id() << ", " << this->name() << "!"; << this->id() << ", " << this->name() << "!";
return -1; return -1;
...@@ -50,7 +50,7 @@ int Op::deinit() { ...@@ -50,7 +50,7 @@ int Op::deinit() {
_timer = NULL; _timer = NULL;
if (release_channel() != 0) { if (release_channel() != 0) {
LOG(FATAL) << "Failed release channel in op:" LOG(ERROR) << "Failed release channel in op:"
<< this->id() << ", " << this->name() << "!"; << this->id() << ", " << this->name() << "!";
return -1; return -1;
} }
...@@ -60,12 +60,12 @@ int Op::deinit() { ...@@ -60,12 +60,12 @@ int Op::deinit() {
int Op::check_time(const char* tag) { int Op::check_time(const char* tag) {
if (!_timer) { if (!_timer) {
LOG(FATAL) << "Invalid timer in op"; LOG(ERROR) << "Invalid timer in op";
return -1; return -1;
} }
if (!_timer->check(tag)) { if (!_timer->check(tag)) {
LOG(FATAL) << "Failed check timer:" << tag; LOG(ERROR) << "Failed check timer:" << tag;
return -1; return -1;
} }
...@@ -78,7 +78,7 @@ int Op::process(bool debug) { ...@@ -78,7 +78,7 @@ int Op::process(bool debug) {
_timer->start(); _timer->start();
} }
if (!_has_init) { if (!_has_init) {
LOG(FATAL) LOG(ERROR)
<< "Make sure op has been init before inference"; << "Make sure op has been init before inference";
return ERR_INTERNAL_FAILURE; return ERR_INTERNAL_FAILURE;
} }
...@@ -93,7 +93,7 @@ int Op::process(bool debug) { ...@@ -93,7 +93,7 @@ int Op::process(bool debug) {
/* /*
DagNode* node = _dag->node_by_name(this->name()); DagNode* node = _dag->node_by_name(this->name());
if (node == NULL) { if (node == NULL) {
LOG(FATAL) << "Failed get node of op:" << this->name(); LOG(ERROR) << "Failed get node of op:" << this->name();
return -1; return -1;
} }
boost::unordered_map<std::string, EdgeMode>& depends = boost::unordered_map<std::string, EdgeMode>& depends =
...@@ -290,7 +290,7 @@ uint32_t Op::id() const { ...@@ -290,7 +290,7 @@ uint32_t Op::id() const {
const std::string Op::debug_string() { const std::string Op::debug_string() {
const Channel* channel = get_channel(); const Channel* channel = get_channel();
if (!channel) { if (!channel) {
LOG(FATAL) << "Invalid channel!"; LOG(ERROR) << "Invalid channel!";
return "Invalid channel in OP"; return "Invalid channel in OP";
} }
return channel->debug_string(); return channel->debug_string();
......
...@@ -43,7 +43,7 @@ public: ...@@ -43,7 +43,7 @@ public:
OpChannel<T>* op_channel = OpChannel<T>* op_channel =
dynamic_cast<OpChannel<T>*>(channel); dynamic_cast<OpChannel<T>*>(channel);
if (!op_channel) { if (!op_channel) {
LOG(FATAL) << "Cannot dynamic cast channel of op:" LOG(ERROR) << "Cannot dynamic cast channel of op:"
<< this->name() << " to type: " << typeid(T).name(); << this->name() << " to type: " << typeid(T).name();
return NULL; return NULL;
} }
...@@ -63,7 +63,7 @@ public: ...@@ -63,7 +63,7 @@ public:
const OpChannel<T>* op_channel = const OpChannel<T>* op_channel =
dynamic_cast<const OpChannel<T>*>(channel); dynamic_cast<const OpChannel<T>*>(channel);
if (!op_channel) { if (!op_channel) {
LOG(FATAL) << "Cannot dynamic cast channel of op:" LOG(ERROR) << "Cannot dynamic cast channel of op:"
<< this->name() << " to type: " << typeid(T).name(); << this->name() << " to type: " << typeid(T).name();
return NULL; return NULL;
} }
...@@ -197,7 +197,7 @@ public: ...@@ -197,7 +197,7 @@ public:
_channel = butil::get_object<ChannelType>(); _channel = butil::get_object<ChannelType>();
if (!_channel) { if (!_channel) {
LOG(FATAL) LOG(ERROR)
<< "Failed mutable channel of type:" << "Failed mutable channel of type:"
<< typeid(T).name(); << typeid(T).name();
return NULL; return NULL;
......
...@@ -524,7 +524,7 @@ private: ...@@ -524,7 +524,7 @@ private:
" LOG(INFO) << \"Failed fetch response from stub handler, new it\";\n" " LOG(INFO) << \"Failed fetch response from stub handler, new it\";\n"
" cur_res = response->New();\n" " cur_res = response->New();\n"
" if (cur_res == NULL) {\n" " if (cur_res == NULL) {\n"
" LOG(FATAL) << \"Failed new response item!\";\n" " LOG(ERROR) << \"Failed new response item!\";\n"
" _stub_handler->update_average(1, \"pack_fail\");\n" " _stub_handler->update_average(1, \"pack_fail\");\n"
" return brpc::SubCall::Bad();\n" " return brpc::SubCall::Bad();\n"
" }\n" " }\n"
...@@ -548,7 +548,7 @@ private: ...@@ -548,7 +548,7 @@ private:
" response->MergeFrom(*sub_response);\n" " response->MergeFrom(*sub_response);\n"
" return brpc::ResponseMerger::MERGED;\n" " return brpc::ResponseMerger::MERGED;\n"
"} catch (const std::exception& e) {\n" "} catch (const std::exception& e) {\n"
" LOG(FATAL) << \"Merge failed.\";\n" " LOG(ERROR) << \"Merge failed.\";\n"
" _stub_handler->update_average(1, \"pack_fail\");\n" " _stub_handler->update_average(1, \"pack_fail\");\n"
" return brpc::ResponseMerger::FAIL;\n" " return brpc::ResponseMerger::FAIL;\n"
"}\n"); "}\n");
...@@ -603,7 +603,7 @@ private: ...@@ -603,7 +603,7 @@ private:
printer->Print( printer->Print(
"sub_req = dynamic_cast<$req_type$*>(_stub_handler->fetch_request());\n" "sub_req = dynamic_cast<$req_type$*>(_stub_handler->fetch_request());\n"
"if (sub_req == NULL) {\n" "if (sub_req == NULL) {\n"
" LOG(FATAL) << \"failed fetch sub_req from stub.\";\n" " LOG(ERROR) << \"failed fetch sub_req from stub.\";\n"
" _stub_handler->update_average(1, \"pack_fail\");\n" " _stub_handler->update_average(1, \"pack_fail\");\n"
" return brpc::SubCall::Bad();\n" " return brpc::SubCall::Bad();\n"
"}\n", "}\n",
...@@ -613,7 +613,7 @@ private: ...@@ -613,7 +613,7 @@ private:
} else { } else {
printer->Print( printer->Print(
"if (req->$field_name$_size() != total_size) {\n" "if (req->$field_name$_size() != total_size) {\n"
" LOG(FATAL) << \"pack field size not consistency: \"\n" " LOG(ERROR) << \"pack field size not consistency: \"\n"
" << total_size << \"!=\" << req->$field_name$_size()\n" " << total_size << \"!=\" << req->$field_name$_size()\n"
" << \", field: $field_name$.\";\n" " << \", field: $field_name$.\";\n"
" _stub_handler->update_average(1, \"pack_fail\");\n" " _stub_handler->update_average(1, \"pack_fail\");\n"
...@@ -643,7 +643,7 @@ private: ...@@ -643,7 +643,7 @@ private:
"if (sub_req == NULL) { // no packed items\n" "if (sub_req == NULL) { // no packed items\n"
" sub_req = dynamic_cast<$req_type$*>(_stub_handler->fetch_request());\n" " sub_req = dynamic_cast<$req_type$*>(_stub_handler->fetch_request());\n"
" if (!sub_req) {\n" " if (!sub_req) {\n"
" LOG(FATAL) << \"failed fetch sub_req from stub handler.\";\n" " LOG(ERROR) << \"failed fetch sub_req from stub handler.\";\n"
" _stub_handler->update_average(1, \"pack_fail\");\n" " _stub_handler->update_average(1, \"pack_fail\");\n"
" return brpc::SubCall::Bad();\n" " return brpc::SubCall::Bad();\n"
" }\n" " }\n"
...@@ -681,7 +681,7 @@ private: ...@@ -681,7 +681,7 @@ private:
printer->Print( printer->Print(
"google::protobuf::Message* sub_res = _stub_handler->fetch_response();\n" "google::protobuf::Message* sub_res = _stub_handler->fetch_response();\n"
"if (sub_res == NULL) {\n" "if (sub_res == NULL) {\n"
" LOG(FATAL) << \"failed create sub_res from res.\";\n" " LOG(ERROR) << \"failed create sub_res from res.\";\n"
" _stub_handler->update_average(1, \"pack_fail\");\n" " _stub_handler->update_average(1, \"pack_fail\");\n"
" return brpc::SubCall::Bad();\n" " return brpc::SubCall::Bad();\n"
"}\n" "}\n"
......
...@@ -138,7 +138,7 @@ int main(int argc, char** argv) { ...@@ -138,7 +138,7 @@ int main(int argc, char** argv) {
int errcode = bthread_set_worker_startfn(pthread_worker_start_fn); int errcode = bthread_set_worker_startfn(pthread_worker_start_fn);
if (errcode != 0) { if (errcode != 0) {
LOG(FATAL) << "Failed call pthread worker start function, error_code[" << errcode << "]"; LOG(ERROR) << "Failed call pthread worker start function, error_code[" << errcode << "]";
return -1; return -1;
} }
LOG(INFO) << "Succ call pthread worker start function"; LOG(INFO) << "Succ call pthread worker start function";
......
...@@ -40,3 +40,14 @@ target_include_directories(mapcnn_sparse PUBLIC ...@@ -40,3 +40,14 @@ target_include_directories(mapcnn_sparse PUBLIC
target_link_libraries(mapcnn_sparse sdk-cpp -lpthread -lcrypto -lm -lrt -lssl target_link_libraries(mapcnn_sparse sdk-cpp -lpthread -lcrypto -lm -lrt -lssl
-ldl -lz) -ldl -lz)
# install
install(TARGETS sdk-cpp
ARCHIVE DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/lib
)
install(TARGETS ximage
RUNTIME DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/demo/client/bin)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/conf DESTINATION
${PADDLE_SERVING_INSTALL_DIR}/demo/client/)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/data DESTINATION
${PADDLE_SERVING_INSTALL_DIR}/demo/client/)
[DefaultVariantInfo]
Tag : default
[.Connection]
ConnectTimeoutMilliSec: 2000
RpcTimeoutMilliSec: 20000
ConnectRetryCount : 2
MaxConnectionPerHost : 100
HedgeRequestTimeoutMilliSec: -1
HedgeFetchRetryCount : 2
BnsReloadIntervalSeconds : 10
ConnectionType : pooled
[.NamingInfo]
ClusterFilterStrategy : Default
LoadBalanceStrategy : la
[.RpcParameter]
# 0-NONE, 1-SNAPPY, 2-GZIP, 3-ZLIB, 4-LZ4
CompressType : 0
PackageSize : 20
Protocol : baidu_std
MaxChannelPerRequest : 3
[@Predictor]
name : ximage
service_name : baidu.paddle_serving.predictor.image_classification.ImageClassifyService
endpoint_router : WeightedRandomRender
[.WeightedRandomRender]
VariantWeightList : 50
[.@VariantInfo]
Tag : var1
[..NamingInfo]
Cluster : list://127.0.0.1:8010
#Cluster : list://10.88.158.21:8010
[DefaultVariantInfo]
Tag : default
[.Connection]
ConnectTimeoutMilliSec: 2000
RpcTimeoutMilliSec: 20000
ConnectRetryCount : 2
MaxConnectionPerHost : 100
HedgeRequestTimeoutMilliSec: -1
HedgeFetchRetryCount : 2
BnsReloadIntervalSeconds : 10
ConnectionType : pooled
[.NamingInfo]
ClusterFilterStrategy : Default
LoadBalanceStrategy : la
[.RpcParameter]
# 0-NONE, 1-SNAPPY, 2-GZIP, 3-ZLIB, 4-LZ4
CompressType : 0
PackageSize : 20
Protocol : baidu_std
MaxChannelPerRequest : 3
[@Predictor]
name : ximage
service_name : baidu.paddle_serving.predictor.image_classification.ImageClassifyService
endpoint_router : WeightedRandomRender
[.WeightedRandomRender]
VariantWeightList : 50
[.@VariantInfo]
Tag : var1
[..NamingInfo]
Cluster : list://127.0.0.1:8010
#Cluster : list://10.88.158.21:8010
[@Predictor]
name : dense_cnn
service_name : baidu.paddle_serving.fluid_engine.DefaultDenseService
endpoint_router : WeightedRandomRender
[.WeightedRandomRender]
VariantWeightList : 25
[.@VariantInfo]
Tag : var1
[..NamingInfo]
Cluster : list://10.194.83.21:8010
#Cluster : bns://opera-ps-mapcnn-000-nj03.MAP.nj03
[..Connection]
[@Predictor]
name : sparse_cnn
service_name : baidu.paddle_serving.fluid_engine.DefaultSparseService
endpoint_router : WeightedRandomRender
[.WeightedRandomRender]
VariantWeightList : 25
[.@VariantInfo]
Tag : var1
[..NamingInfo]
Cluster : list://10.194.83.21:8010
#Cluster : bns://opera-ps-mapcnn-000-nj03.MAP.nj03
[..Connection]
[@Predictor]
name : wasq
service_name : baidu.infinite.map_rnn.MapRnnService
endpoint_router : WeightedRandomRender
[.WeightedRandomRender]
VariantWeightList : 25
[.@VariantInfo]
Tag : var1
[..NamingInfo]
Cluster : list://127.0.0.1:8010
#Cluster : bns://opera-ps-mapcnn-000-nj03.MAP.nj03
[..Connection]
...@@ -36,7 +36,7 @@ public: ...@@ -36,7 +36,7 @@ public:
pthread_mutex_init(&_mutex, NULL); pthread_mutex_init(&_mutex, NULL);
FILE* fp = fopen(file_name.c_str(), "r"); FILE* fp = fopen(file_name.c_str(), "r");
if (!fp) { if (!fp) {
LOG(FATAL) << "Failed open data file: " LOG(ERROR) << "Failed open data file: "
<< file_name; << file_name;
return -1; return -1;
} }
...@@ -58,7 +58,7 @@ public: ...@@ -58,7 +58,7 @@ public:
for (size_t ri = 0; ri < buf_size; ri++) { for (size_t ri = 0; ri < buf_size; ri++) {
Request* req = new Request(); Request* req = new Request();
if (generate_one_req(*req, batch_size) != 0) { if (generate_one_req(*req, batch_size) != 0) {
LOG(FATAL) << "Failed generate req at: " << ri; LOG(ERROR) << "Failed generate req at: " << ri;
fclose(fp); fclose(fp);
return -1; return -1;
} }
...@@ -229,7 +229,7 @@ void* work(void* p) { ...@@ -229,7 +229,7 @@ void* work(void* p) {
while (true) { while (true) {
Predictor* predictor = api->fetch_predictor("mapcnn"); Predictor* predictor = api->fetch_predictor("mapcnn");
if (!predictor) { if (!predictor) {
LOG(FATAL) << "Failed fetch predictor: wasq"; LOG(ERROR) << "Failed fetch predictor: wasq";
return NULL; return NULL;
} }
Request* req = input->next_req(); Request* req = input->next_req();
...@@ -237,7 +237,7 @@ void* work(void* p) { ...@@ -237,7 +237,7 @@ void* work(void* p) {
timeval start; timeval start;
gettimeofday(&start, NULL); gettimeofday(&start, NULL);
if (predictor->inference(req, &res) != 0) { if (predictor->inference(req, &res) != 0) {
LOG(FATAL) << "failed call predictor with req:" LOG(ERROR) << "failed call predictor with req:"
<< req->ShortDebugString(); << req->ShortDebugString();
return NULL; return NULL;
} }
...@@ -264,19 +264,19 @@ int main(int argc, char** argv) { ...@@ -264,19 +264,19 @@ int main(int argc, char** argv) {
int qps = atoi(argv[4]); int qps = atoi(argv[4]);
PredictorApi api; PredictorApi api;
if (api.create("./conf", "predictors.conf") != 0) { if (api.create("./conf", "predictors.conf") != 0) {
LOG(FATAL) << "Failed create predictors api!"; LOG(ERROR) << "Failed create predictors api!";
return -1; return -1;
} }
InputData data; InputData data;
if (data.create( if (data.create(
"./data/pure_feature", req_buffer, batch_size, qps) != 0) { "./data/pure_feature", req_buffer, batch_size, qps) != 0) {
LOG(FATAL) << "Failed create inputdata!"; LOG(ERROR) << "Failed create inputdata!";
return -1; return -1;
} }
Arg arg = {&api, &data}; Arg arg = {&api, &data};
pthread_t* threads = new pthread_t[thread_num]; pthread_t* threads = new pthread_t[thread_num];
if (!threads) { if (!threads) {
LOG(FATAL) << "Failed create threads, num:" << thread_num; LOG(ERROR) << "Failed create threads, num:" << thread_num;
return -1; return -1;
} }
for (int i = 0; i < thread_num; ++i) { for (int i = 0; i < thread_num; ++i) {
......
...@@ -295,7 +295,7 @@ public: ...@@ -295,7 +295,7 @@ public:
_data_record = data; _data_record = data;
/*FILE* fp = fopen(file_name.c_str(), "r"); /*FILE* fp = fopen(file_name.c_str(), "r");
if (!fp) { if (!fp) {
LOG(FATAL) << "Failed open data file: " LOG(ERROR) << "Failed open data file: "
<< file_name; << file_name;
return -1; return -1;
} }
......
...@@ -12,3 +12,12 @@ target_link_libraries(image_class opencv_imgcodecs ...@@ -12,3 +12,12 @@ target_link_libraries(image_class opencv_imgcodecs
${opencv_depend_libs} -Wl,--whole-archive fluid_cpu_engine ${opencv_depend_libs} -Wl,--whole-archive fluid_cpu_engine
-Wl,--no-whole-archive pdserving paddle_fluid ${paddle_depend_libs} -Wl,--no-whole-archive pdserving paddle_fluid ${paddle_depend_libs}
${MKLML_LIB} ${MKLML_IOMP_LIB} -lpthread -lcrypto -lm -lrt -lssl -ldl -lz) ${MKLML_LIB} ${MKLML_IOMP_LIB} -lpthread -lcrypto -lm -lrt -lssl -ldl -lz)
install(TARGETS image_class
RUNTIME DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/demo/serving/bin)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/conf DESTINATION
${PADDLE_SERVING_INSTALL_DIR}/demo/serving/)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/data DESTINATION
${PADDLE_SERVING_INSTALL_DIR}/demo/serving/)
workflow_type: Sequence
[@Node]
name: dense_op
type: DenseOp
workflow_type: Sequence
[@Node]
name: image_reader_op
type: ReaderOp
[@Node]
name: image_classify_op
type: ClassifyOp
[.@Depend]
name: image_reader_op
mode: RO
[@Node]
name: write_json_op
type: WriteOp
[.@Depend]
name: image_classify_op
mode: RO
COMLOG_LEVEL : 16
COMLOG_DEVICE_NUM : 2
COMLOG_DEVICE0 : TRACE
COMLOG_DEVICE1 : WARNING
TRACE_OPEN : 1
TRACE_TYPE : FILE
TRACE_PATH : ./log
TRACE_NAME : pdserving.log
TRACE_SYSLEVEL : 0
TRACE_SELFLEVEL : NOTICE,TRACE,DEBUG
TRACE_SIZE : 4000
TRACE_SPLITE_TYPE : DATECUT
TRACE_DATA_CUTTIME : 60
TRACE_DATA_CRONOCUT : 1
TRACE_RESERVED1 : %Y%m%d%H
TRACE_LAYOUT : %L: %A %T %R
TRACE_QUOTA_DAY : 2
WARNING_OPEN : 1
WARNING_TYPE : FILE
WARNING_PATH : ./log
WARNING_NAME : pdserving.log.wf
WARNING_SYSLEVEL : 0
WARNING_SELFLEVEL : WARNING,FATAL
WARNING_SIZE : 4000
WARNING_SPLITE_TYPE : DATECUT
WARNING_DATA_CUTTIME : 60
WARNING_DATA_CRONOCUT : 1
WARNING_RESERVED1 : %Y%m%d%H
WARNING_LAYOUT : %L: %A %T %R
WARNING_QUOTA_DAY : 2
[@Engine]
Type : FLUID_CPU_NATIVE_DIR
Name : image_classification_resnet
ReloadableMeta: ./data/model/paddle/fluid_time_file
ReloadableType: timestamp_ne
ModelDataPath: ./data/model/paddle/fluid/SE_ResNeXt50_32x4d
RuntimeThreadNum: 0
BatchInferSize: 0
EnableBatchAlign: 0
# model toolkit conf
model_toolkit_path: ./conf
model_toolkit_file: model_toolkit.conf
[@Service]
name: ImageClassifyService
@workflow: workflow1
[@Service]
name: BuiltinDenseFormatService
@workflow: workflow2
[@Workflow]
name: workflow1
path: ./conf
file: imagec_dag.conf
[@Workflow]
name: workflow2
path: ./conf
file: dense_dag.conf
...@@ -46,7 +46,7 @@ int ReaderOp::inference() { ...@@ -46,7 +46,7 @@ int ReaderOp::inference() {
const char* binary = ins.image_binary().c_str(); const char* binary = ins.image_binary().c_str();
size_t length = ins.image_length(); size_t length = ins.image_length();
if (length == 0) { if (length == 0) {
LOG(FATAL) << "Empty image, length is 0"; LOG(ERROR) << "Empty image, length is 0";
return -1; return -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册