You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2017/03/15 21:21:14 UTC
[13/13] mesos git commit: Simplified task id procurement in command
executor.
Simplified task id procurement in command executor.
Review: https://reviews.apache.org/r/57150
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e60b57b4
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e60b57b4
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e60b57b4
Branch: refs/heads/master
Commit: e60b57b438289323f8ab4c91b83c113b066f320b
Parents: a67231b
Author: Alexander Rukletsov <al...@apache.org>
Authored: Tue Feb 28 16:24:42 2017 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Wed Mar 15 22:20:20 2017 +0100
----------------------------------------------------------------------
src/launcher/executor.cpp | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/e60b57b4/src/launcher/executor.cpp
----------------------------------------------------------------------
diff --git a/src/launcher/executor.cpp b/src/launcher/executor.cpp
index 02834c9..a32ec5b 100644
--- a/src/launcher/executor.cpp
+++ b/src/launcher/executor.cpp
@@ -375,11 +375,9 @@ protected:
return;
}
- // Capture the task.
+ // Capture `TaskInfo` and `TaskID` of the task.
CHECK(taskData.isNone());
taskData = TaskData(task);
-
- // Capture the TaskID.
taskId = task.task_id();
// Capture the kill policy.
@@ -406,8 +404,7 @@ protected:
} else if (task.has_command()) {
command = task.command();
} else {
- LOG(FATAL) << "Expecting task '" << taskData.taskInfo->task_id()
- << "' to have a command";
+ LOG(FATAL) << "Expecting task '" << taskId.get() << "' to have a command";
}
// TODO(jieyu): For now, we just fail the executor if the task's
@@ -417,12 +414,10 @@ protected:
// correct solution is to perform this validation at master side.
if (command.shell()) {
CHECK(command.has_value())
- << "Shell command of task '" << taskData.taskInfo->task_id()
- << "' is not specified!";
+ << "Shell command of task '" << taskId.get() << "' is not specified";
} else {
CHECK(command.has_value())
- << "Executable of task '" << taskData.taskInfo->task_id()
- << "' is not specified!";
+ << "Executable of task '" << taskId.get() << "' is not specified";
}
// Determine the environment for the command to be launched.
@@ -450,7 +445,7 @@ protected:
launchEnvironment.MergeFrom(command.environment());
}
- cout << "Starting task " << taskData.taskInfo->task_id() << endl;
+ cout << "Starting task " << taskId.get() << endl;
#ifndef __WINDOWS__
pid = launchTaskPosix(
@@ -496,7 +491,7 @@ protected:
task.health_check(),
launcherDir,
defer(self(), &Self::taskHealthUpdated, lambda::_1),
- taskData.taskInfo->task_id(),
+ taskId.get(),
pid,
namespaces);
@@ -513,8 +508,7 @@ protected:
process::reap(pid)
.onAny(defer(self(), &Self::reaped, pid, lambda::_1));
- TaskStatus status =
- createTaskStatus(taskData.taskInfo->task_id(), TASK_RUNNING);
+ TaskStatus status = createTaskStatus(taskId.get(), TASK_RUNNING);
forward(status);
launched = true;