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

Method MesosProcess

src/executor/executor.cpp:162–349  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160{
161public:
162 MesosProcess(
163 ContentType _contentType,
164 const lambda::function<void(void)>& connected,
165 const lambda::function<void(void)>& disconnected,
166 const lambda::function<void(const queue<Event>&)>& received,
167 const std::map<std::string, std::string>& environment)
168 : ProcessBase(generate("executor")),
169 state(DISCONNECTED),
170 contentType(_contentType),
171 callbacks {connected, disconnected, received}
172 {
173 GOOGLE_PROTOBUF_VERIFY_VERSION;
174
175 // Load any logging flags from the environment.
176 logging::Flags flags;
177
178 // Filter out environment variables whose keys don't start with "MESOS_".
179 //
180 // TODO(alexr): This should be supported by `FlagsBase`, see MESOS-9001.
181 std::map<std::string, std::string> mesosEnvironment;
182
183 foreachpair (const string& key, const string& value, environment) {
184 if (strings::startsWith(key, "MESOS_")) {
185 mesosEnvironment.emplace(key, value);
186 }
187 }
188
189 Try<flags::Warnings> load = flags.load(mesosEnvironment, true);
190
191 if (load.isError()) {
192 EXIT(EXIT_FAILURE) << "Failed to load flags: " << load.error();
193 }
194
195 // Initialize libprocess.
196 process::initialize();
197
198 // Initialize logging.
199 if (flags.initialize_driver_logging) {
200 logging::initialize("mesos", false, flags);
201 } else {
202 VLOG(1) << "Disabling initialization of GLOG logging";
203 }
204
205 // Log any flag warnings (after logging is initialized).
206 foreach (const flags::Warning& warning, load->warnings) {
207 LOG(WARNING) << warning.message;
208 }
209
210 LOG(INFO) << "Version: " << MESOS_VERSION;
211
212 spawn(new VersionProcess(), true);
213
214 hashmap<string, string> env(mesosEnvironment);
215
216 // Check if this is local (for example, for testing).
217 local = env.contains("MESOS_LOCAL");
218
219 Option<string> value;

Callers

nothing calls this directly

Calls 15

generateFunction · 0.85
relativeFunction · 0.85
errorMethod · 0.65
initializeFunction · 0.50
spawnFunction · 0.50
getcwdFunction · 0.50
URLClass · 0.50
eraseenvFunction · 0.50
parseFunction · 0.50
loadMethod · 0.45
isErrorMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected