MCPcopy Create free account
hub / github.com/alibaba/euler / StartService

Function StartService

euler/service/python_api.cc:29–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27extern "C" {
28
29 void* StartService(
30 const char* directory,
31 const char* shard_idx,
32 const char* shard_num,
33 const char* zk_addr,
34 const char* zk_path,
35 const char* load_data_type,
36 const char* global_sampler_type,
37 const char* server_thread_num) {
38 ServerDef server_def =
39 {"grpc", atoi(shard_idx), atoi(shard_num), {}};
40
41 server_def.options.emplace("port", std::to_string(GetFreePort()));
42 server_def.options.emplace("data_path", directory);
43 server_def.options.emplace("zk_server", zk_addr);
44 server_def.options.emplace("zk_path", zk_path);
45 server_def.options.emplace("load_data_type", load_data_type);
46 server_def.options.emplace("global_sampler_type", global_sampler_type);
47 server_def.options.emplace("num_threads", server_thread_num);
48
49 std::unique_ptr<ServerInterface> server_;
50 auto s = NewServer(server_def, &server_);
51 if (!s.ok()) {
52 EULER_LOG(ERROR) << "Create euler server failed, status: " << s;
53 return nullptr;
54 }
55
56 s = server_->Start();
57 if (!s.ok()) {
58 EULER_LOG(ERROR) << "Start euler server failed, status: " << s;
59 return nullptr;
60 }
61
62 return server_.release();
63 }
64
65}
66

Callers

nothing calls this directly

Calls 5

GetFreePortFunction · 0.85
NewServerFunction · 0.85
emplaceMethod · 0.80
okMethod · 0.80
StartMethod · 0.45

Tested by

no test coverage detected