MCPcopy Create free account
hub / github.com/PaddlePaddle/Serving / main

Function main

tools/cpp_examples/demo-client/src/int64tensor_format.cpp:74–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74int main(int argc, char** argv) {
75 PredictorApi api;
76
77// initialize logger instance
78#ifdef BCLOUD
79 logging::LoggingSettings settings;
80 settings.logging_dest = logging::LOG_TO_FILE;
81
82 std::string filename(argv[0]);
83 filename = filename.substr(filename.find_last_of('/') + 1);
84 settings.log_file = (std::string("./log/") + filename + ".log").c_str();
85 settings.delete_old = logging::DELETE_OLD_LOG_FILE;
86 logging::InitLogging(settings);
87
88 logging::ComlogSinkOptions cso;
89 cso.process_name = filename;
90 cso.enable_wf_device = true;
91 logging::ComlogSink::GetInstance()->Setup(&cso);
92#else
93 struct stat st_buf;
94 int ret = 0;
95 if ((ret = stat("./log", &st_buf)) != 0) {
96 mkdir("./log", 0777);
97 ret = stat("./log", &st_buf);
98 if (ret != 0) {
99 LOG(WARNING) << "Log path ./log not exist, and create fail";
100 return -1;
101 }
102 }
103 FLAGS_log_dir = "./log";
104 google::InitGoogleLogging(strdup(argv[0]));
105#endif
106
107 if (api.create("./conf", "predictors.prototxt") != 0) {
108 LOG(ERROR) << "Failed create predictors api!";
109 return -1;
110 }
111
112 Request req;
113 Response res;
114
115 api.thrd_initialize();
116
117 while (true) {
118 timeval start;
119 gettimeofday(&start, NULL);
120
121 api.thrd_clear();
122
123 Predictor* predictor = api.fetch_predictor("int64tensor_service");
124 if (!predictor) {
125 LOG(ERROR) << "Failed fetch predictor: int64tensor_service";
126 return -1;
127 }
128
129 req.Clear();
130 res.Clear();
131

Callers

nothing calls this directly

Calls 13

statClass · 0.70
create_reqFunction · 0.70
print_resFunction · 0.70
createMethod · 0.45
thrd_initializeMethod · 0.45
thrd_clearMethod · 0.45
fetch_predictorMethod · 0.45
ClearMethod · 0.45
debugMethod · 0.45
ShortDebugStringMethod · 0.45
tagMethod · 0.45
thrd_finalizeMethod · 0.45

Tested by

no test coverage detected