49 {
50 Scheduler* obj = instance.load(std::memory_order_acquire);
51 if (obj == nullptr) {
52 std::lock_guard<std::mutex> lock(mutex);
53 obj = instance.load(std::memory_order_relaxed);
54 if (obj == nullptr) {
55 std::string policy("classic");
56 std::string conf("conf/");
57 conf.append(GlobalData::Instance()->ProcessGroup()).append(".conf");
62 } else {
63 AWARN <<
"Scheduler conf named " << cfg_file
64 << " not found, use default.";
65 }
66 if (!policy.compare("classic")) {
67 obj = new SchedulerClassic();
68 } else if (!policy.compare("choreography")) {
69 obj = new SchedulerChoreography();
70 } else {
71 AWARN <<
"Invalid scheduler policy: " << policy;
72 obj = new SchedulerClassic();
73 }
74 instance.store(obj, std::memory_order_release);
75 }
76 }
77 return obj;
78}
bool PathExists(const std::string &path)
Check if the path exists.
bool GetProtoFromFile(const std::string &file_name, google::protobuf::Message *message)
Parses the content of the file specified by the file_name as a representation of protobufs,...
std::string GetAbsolutePath(const std::string &prefix, const std::string &relative_path)
Get absolute path by concatenating prefix and relative_path.
const std::string WorkRoot()
optional SchedulerConf scheduler_conf