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

Method getExecutorInfo

src/slave/slave.cpp:6761–6955  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6759
6760
6761ExecutorInfo Slave::getExecutorInfo(
6762 const FrameworkInfo& frameworkInfo,
6763 const TaskInfo& task) const
6764{
6765 // In the case of tasks launched as part of a task group, the task group's
6766 // ExecutorInfo is injected into each TaskInfo by the master and we return
6767 // it here.
6768 if (task.has_executor()) {
6769 return task.executor();
6770 }
6771
6772 ExecutorInfo executor;
6773
6774 // Command executors share the same id as the task.
6775 executor.mutable_executor_id()->set_value(task.task_id().value());
6776 executor.mutable_framework_id()->CopyFrom(frameworkInfo.id());
6777
6778 if (task.has_container()) {
6779 // Store the container info in the executor info so it will
6780 // be checkpointed. This allows the correct containerizer to
6781 // recover this task on restart.
6782 executor.mutable_container()->CopyFrom(task.container());
6783 }
6784
6785 // Prepare an executor name which includes information on the
6786 // command being launched.
6787 string name = "(Task: " + task.task_id().value() + ") ";
6788
6789 if (task.command().shell()) {
6790 if (!task.command().has_value()) {
6791 name += "(Command: NO COMMAND)";
6792 } else {
6793#ifdef __WINDOWS__
6794 name += "(Command: cmd /c '";
6795#else
6796 name += "(Command: sh -c '";
6797#endif // __WINDOWS__
6798 if (task.command().value().length() > 15) {
6799 name += task.command().value().substr(0, 12) + "...')";
6800 } else {
6801 name += task.command().value() + "')";
6802 }
6803 }
6804 } else {
6805 if (!task.command().has_value()) {
6806 name += "(Command: NO EXECUTABLE)";
6807 } else {
6808 string args =
6809 task.command().value() + ", " +
6810 strings::join(", ", task.command().arguments());
6811
6812 if (args.length() > 15) {
6813 name += "(Command: [" + args.substr(0, 12) + "...])";
6814 } else {
6815 name += "(Command: [" + args + "])";
6816 }
6817 }
6818 }

Callers 2

TEST_FFunction · 0.80
foreachvalueFunction · 0.80

Calls 15

NanosecondsClass · 0.85
MAX_REAP_INTERVALFunction · 0.85
SecondsClass · 0.85
NoneClass · 0.85
executorMethod · 0.80
CopyFromMethod · 0.80
commandMethod · 0.80
MergeFromMethod · 0.80
nsMethod · 0.80
userMethod · 0.80
typeMethod · 0.80
errorMethod · 0.65

Tested by 1

TEST_FFunction · 0.64