Repository: mesos Updated Branches: refs/heads/master 24317f9d1 -> e490d452a
Renamed isCommandExecutor to isGeneratedForCommandTask. The name `isCommandExecutor` is not really precise because it could also for Docker Executor. This patch renamed this method to be more accurate. Review: https://reviews.apache.org/r/64814 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d9cf4bc2 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d9cf4bc2 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d9cf4bc2 Branch: refs/heads/master Commit: d9cf4bc25055b30c9f7de8971e8b991394275301 Parents: 24317f9 Author: Jie Yu <[email protected]> Authored: Fri Dec 22 13:20:57 2017 -0800 Committer: Jie Yu <[email protected]> Committed: Fri Dec 22 15:28:17 2017 -0800 ---------------------------------------------------------------------- src/slave/slave.cpp | 36 +++++++++++++++++++----------------- src/slave/slave.hpp | 8 +++++--- 2 files changed, 24 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/d9cf4bc2/src/slave/slave.cpp ---------------------------------------------------------------------- diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp index dde3dac..e0806ab 100644 --- a/src/slave/slave.cpp +++ b/src/slave/slave.cpp @@ -1618,9 +1618,10 @@ void Slave::doReliableRegistration(Duration maxBackoff) task, TASK_STAGING, framework->id())); } - // Do not re-register with Command Executors because the - // master doesn't store them; they are generated by the slave. - if (!executor->isCommandExecutor()) { + // Do not re-register with Command (or Docker) Executors + // because the master doesn't store them; they are generated + // by the slave. + if (!executor->isGeneratedForCommandTask()) { // Ignore terminated executors because they do not consume // any resources. if (executor->state != Executor::TERMINATED) { @@ -3023,7 +3024,7 @@ void Slave::launchExecutor( ->CopyFrom(executorInfo_.container()); } - if (executor->isCommandExecutor()) { + if (executor->isGeneratedForCommandTask()) { CHECK_SOME(taskInfo) << "Command (or Docker) executor does not support task group"; @@ -5593,8 +5594,8 @@ ExecutorInfo Slave::getExecutorInfo( "'; exit 1"); } - // Add an allowance for the command executor. This does lead to a - // small overcommit of resources. + // Add an allowance for the command (or docker) executor. This does + // lead to a small overcommit of resources. // // NOTE: The size of the memory is truncated here to preserve the // existing behavior for backward compatibility. @@ -5850,11 +5851,11 @@ void Slave::executorTerminated( } } - // Only send ExitedExecutorMessage if it is not a Command - // Executor because the master doesn't store them; they are - // generated by the slave. + // Only send ExitedExecutorMessage if it is not a Command (or + // Docker) Executor because the master doesn't store them; they + // are generated by the slave. // TODO(vinod): Reliably forward this message to the master. - if (!executor->isCommandExecutor()) { + if (!executor->isGeneratedForCommandTask()) { ExitedExecutorMessage message; message.mutable_slave_id()->MergeFrom(info.id()); message.mutable_framework_id()->MergeFrom(frameworkId); @@ -8862,15 +8863,16 @@ Executor::Executor( { CHECK_NOTNULL(slave); - // TODO(jieyu): The way we determine if an executor is command - // executor (including docker executor) is really hacky. We rely on - // the fact that docker executor launch command is set in the docker - // containerizer so that this check is still valid in the slave. + // TODO(jieyu): The way we determine if an executor is generated for + // a command task (either command or docker executor) is really + // hacky. We rely on the fact that docker executor launch command is + // set in the docker containerizer so that this check is still valid + // in the slave. Result<string> executorPath = os::realpath(path::join(slave->flags.launcher_dir, MESOS_EXECUTOR)); if (executorPath.isSome()) { - commandExecutor = + isGeneratedForCommandTask_ = strings::contains(info.command().value(), executorPath.get()); } } @@ -9177,9 +9179,9 @@ bool Executor::incompleteTasks() } -bool Executor::isCommandExecutor() const +bool Executor::isGeneratedForCommandTask() const { - return commandExecutor; + return isGeneratedForCommandTask_; } http://git-wip-us.apache.org/repos/asf/mesos/blob/d9cf4bc2/src/slave/slave.hpp ---------------------------------------------------------------------- diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp index e0f0c82..b5eec33 100644 --- a/src/slave/slave.hpp +++ b/src/slave/slave.hpp @@ -855,8 +855,10 @@ public: } } - // Returns true if this is a command executor. - bool isCommandExecutor() const; + // Returns true if this executor is generated by Mesos for a command + // task (either command executor for MesosContainerizer or docker + // executor for DockerContainerizer). + bool isGeneratedForCommandTask() const; // Closes the HTTP connection. void closeHttpConnection(); @@ -947,7 +949,7 @@ private: Executor(const Executor&) = delete; Executor& operator=(const Executor&) = delete; - bool commandExecutor; + bool isGeneratedForCommandTask_; };
