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

Function main

src/launcher/executor.cpp:1366–1468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1364
1365
1366int main(int argc, char** argv)
1367{
1368 mesos::FrameworkID frameworkId;
1369 mesos::ExecutorID executorId;
1370
1371 Flags flags;
1372
1373 // Load flags from command line.
1374 Try<flags::Warnings> load = flags.load(None(), &argc, &argv);
1375
1376 if (flags.help) {
1377 cout << flags.usage() << endl;
1378 return EXIT_SUCCESS;
1379 }
1380
1381 if (load.isError()) {
1382 cerr << flags.usage(load.error()) << endl;
1383 return EXIT_FAILURE;
1384 }
1385
1386 mesos::internal::logging::initialize(argv[0], true, flags); // Catch signals.
1387
1388 // Log any flag warnings (after logging is initialized).
1389 foreach (const flags::Warning& warning, load->warnings) {
1390 LOG(WARNING) << warning.message;
1391 }
1392
1393 Option<string> value = os::getenv("MESOS_FRAMEWORK_ID");
1394 if (value.isNone()) {
1395 EXIT(EXIT_FAILURE)
1396 << "Expecting 'MESOS_FRAMEWORK_ID' to be set in the environment";
1397 }
1398 frameworkId.set_value(value.get());
1399
1400 value = os::getenv("MESOS_EXECUTOR_ID");
1401 if (value.isNone()) {
1402 EXIT(EXIT_FAILURE)
1403 << "Expecting 'MESOS_EXECUTOR_ID' to be set in the environment";
1404 }
1405 executorId.set_value(value.get());
1406
1407 // Get executor shutdown grace period from the environment.
1408 //
1409 // NOTE: We avoided introducing a command executor flag for this
1410 // because the command executor exits if it sees an unknown flag.
1411 // This makes it difficult to add or remove command executor flags
1412 // that are unconditionally set by the agent.
1413 Duration shutdownGracePeriod = DEFAULT_EXECUTOR_SHUTDOWN_GRACE_PERIOD;
1414 value = os::getenv("MESOS_EXECUTOR_SHUTDOWN_GRACE_PERIOD");
1415 if (value.isSome()) {
1416 Try<Duration> parse = Duration::parse(value.get());
1417 if (parse.isError()) {
1418 EXIT(EXIT_FAILURE)
1419 << "Failed to parse value '" << value.get() << "'"
1420 << " of 'MESOS_EXECUTOR_SHUTDOWN_GRACE_PERIOD': " << parse.error();
1421 }
1422
1423 shutdownGracePeriod = parse.get();

Callers

nothing calls this directly

Calls 15

NoneClass · 0.85
finalizeFunction · 0.85
errorMethod · 0.65
initializeFunction · 0.50
getenvFunction · 0.50
parseFunction · 0.50
spawnFunction · 0.50
waitFunction · 0.50
loadMethod · 0.45
usageMethod · 0.45
isErrorMethod · 0.45
isNoneMethod · 0.45

Tested by

no test coverage detected