MCPcopy Create free account
hub / github.com/baidu/tera / InitFlags

Function InitFlags

src/sdk/java/native-src/jni_tera_common.cc:28–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28void InitFlags(std::string confpath) {
29 // init FLAGS_flagfile
30 if (IsExist(confpath)) {
31 FLAGS_flagfile = confpath;
32 } else if (IsExist("./tera.flag")) {
33 FLAGS_flagfile = "./tera.flag";
34 } else {
35 LOG(FATAL) << "tera.flag not exist, job failed.";
36 }
37
38 // init user identity & role
39 std::string cur_identity = tera::utils::GetValueFromEnv("USER");
40 if (cur_identity.empty()) {
41 cur_identity = "other";
42 }
43 if (FLAGS_tera_user_identity.empty()) {
44 FLAGS_tera_user_identity = cur_identity;
45 }
46
47 // init log dir
48 if (FLAGS_log_dir.empty()) {
49 FLAGS_log_dir = "./";
50 }
51 ::google::ReadFromFlagsFile(FLAGS_flagfile, NULL, true);
52 LOG(INFO) << "USER = " << FLAGS_tera_user_identity;
53 LOG(INFO) << "Load config file: " << FLAGS_flagfile;
54}
55
56void InitGlog(std::string prefix) { ::google::InitGoogleLogging(prefix.c_str()); }
57

Callers

nothing calls this directly

Calls 3

GetValueFromEnvFunction · 0.85
IsExistFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected