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

Function main

src/examples/no_executor_framework.cpp:270–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268
269
270int main(int argc, char** argv)
271{
272 Flags flags;
273 Try<flags::Warnings> load = flags.load("MESOS_EXAMPLE_", argc, argv);
274
275 if (flags.help) {
276 cout << flags.usage() << endl;
277 return EXIT_SUCCESS;
278 }
279
280 if (load.isError()) {
281 cerr << flags.usage(load.error()) << endl;
282 return EXIT_FAILURE;
283 }
284
285 logging::initialize(argv[0], true, flags); // Catch signals.
286
287 // Log any flag warnings.
288 foreach (const flags::Warning& warning, load->warnings) {
289 LOG(WARNING) << warning.message;
290 }
291
292 FrameworkInfo framework;
293 framework.set_user(""); // Have Mesos fill in the current user.
294 framework.set_principal(flags.principal);
295 framework.set_name(FRAMEWORK_NAME);
296 framework.set_checkpoint(flags.checkpoint);
297 framework.add_roles(flags.role);
298 framework.add_capabilities()->set_type(
299 FrameworkInfo::Capability::MULTI_ROLE);
300 framework.add_capabilities()->set_type(
301 FrameworkInfo::Capability::RESERVATION_REFINEMENT);
302
303 if (flags.task_revocable_resources.isSome()) {
304 framework.add_capabilities()->set_type(
305 FrameworkInfo::Capability::REVOCABLE_RESOURCES);
306 }
307
308 Try<Resources> resources = Resources::parse(flags.task_resources);
309
310 if (resources.isError()) {
311 EXIT(EXIT_FAILURE) << "Invalid '--task_resources': " << resources.error();
312 }
313
314 Resources taskResources = resources.get();
315
316 if (flags.task_revocable_resources.isSome()) {
317 Try<Resources> revocableResources =
318 Resources::parse(flags.task_revocable_resources.get());
319
320 if (revocableResources.isError()) {
321 EXIT(EXIT_FAILURE) << "Invalid '--task_revocable_resources': "
322 << revocableResources.error();
323 }
324
325 foreach (Resource revocable, revocableResources.get()) {
326 revocable.mutable_revocable();
327 taskResources += revocable;

Callers

nothing calls this directly

Calls 15

protobufFunction · 0.85
errorMethod · 0.65
runMethod · 0.65
stopMethod · 0.65
initializeFunction · 0.50
parseFunction · 0.50
setenvFunction · 0.50
stringifyFunction · 0.50
loadMethod · 0.45
usageMethod · 0.45
isErrorMethod · 0.45
isSomeMethod · 0.45

Tested by

no test coverage detected