MCPcopy Create free account
hub / github.com/apache/mesos / main

Function main

src/local/main.cpp:66–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64
65
66int main(int argc, char **argv)
67{
68 GOOGLE_PROTOBUF_VERIFY_VERSION;
69
70 // TODO(benh): Inherit from both slave::Flags and master::Flags in
71 // order to pass those flags on to the master. Alternatively, add a
72 // way to load flags and ignore unknowns in order to load
73 // master::flags, then slave::Flags, then local::Flags.
74 Flags flags;
75
76 flags.setUsageMessage(
77 "Usage: " + Path(argv[0]).basename() + " [...]\n\n" +
78 "Launches an in-memory cluster within a single process.");
79
80 // Load flags from environment and command line but allow unknown
81 // flags since we might have some master/slave flags as well.
82 Try<flags::Warnings> load = flags.load("MESOS_", argc, argv, true);
83
84 if (flags.help) {
85 cout << flags.usage() << endl;
86 return EXIT_SUCCESS;
87 }
88
89 if (load.isError()) {
90 cerr << flags.usage(load.error()) << endl;
91 return EXIT_FAILURE;
92 }
93
94 logging::initialize(argv[0], false, flags);
95
96 // Log any flag warnings (after logging is initialized).
97 foreach (const flags::Warning& warning, load->warnings) {
98 LOG(WARNING) << warning.message;
99 }
100
101 // Initialize libprocess.
102 os::setenv("LIBPROCESS_PORT", stringify(flags.port));
103
104 if (flags.ip.isSome()) {
105 os::setenv("LIBPROCESS_IP", flags.ip.get());
106 }
107
108 process::initialize("master");
109
110 spawn(new VersionProcess(), true);
111
112 process::wait(local::launch(flags));
113
114 return EXIT_SUCCESS;
115}

Callers

nothing calls this directly

Calls 15

PathClass · 0.85
setUsageMessageMethod · 0.80
launchFunction · 0.70
errorMethod · 0.65
initializeFunction · 0.50
setenvFunction · 0.50
stringifyFunction · 0.50
spawnFunction · 0.50
waitFunction · 0.50
basenameMethod · 0.45
loadMethod · 0.45
usageMethod · 0.45

Tested by

no test coverage detected