Added helper function for the agent to send `ExitedExecutorMessage`. Review: https://reviews.apache.org/r/65446/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/fb0e2f1f Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/fb0e2f1f Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/fb0e2f1f Branch: refs/heads/1.5.x Commit: fb0e2f1f81b2256a76cae83893e2a69fdd91fcd7 Parents: 10aa875 Author: Meng Zhu <m...@mesosphere.io> Authored: Tue Feb 13 22:45:03 2018 -0800 Committer: Greg Mann <gregorywm...@gmail.com> Committed: Wed Feb 14 03:41:16 2018 -0800 ---------------------------------------------------------------------- src/slave/slave.cpp | 25 ++++++++++++++++++------- src/slave/slave.hpp | 5 +++++ 2 files changed, 23 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/fb0e2f1f/src/slave/slave.cpp ---------------------------------------------------------------------- diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp index 4470b09..4e2b33a 100644 --- a/src/slave/slave.cpp +++ b/src/slave/slave.cpp @@ -6070,13 +6070,7 @@ void Slave::executorTerminated( // are generated by the slave. // TODO(vinod): Reliably forward this message to the master. if (!executor->isGeneratedForCommandTask()) { - ExitedExecutorMessage message; - message.mutable_slave_id()->MergeFrom(info.id()); - message.mutable_framework_id()->MergeFrom(frameworkId); - message.mutable_executor_id()->MergeFrom(executorId); - message.set_status(status); - - if (master.isSome()) { send(master.get(), message); } + sendExitedExecutorMessage(frameworkId, executorId, status); } // Remove the executor if either the slave or framework is @@ -8280,6 +8274,23 @@ void Slave::sendExecutorTerminatedStatusUpdate( } +void Slave::sendExitedExecutorMessage( + const FrameworkID& frameworkId, + const ExecutorID& executorId, + const Option<int>& status) +{ + ExitedExecutorMessage message; + message.mutable_slave_id()->MergeFrom(info.id()); + message.mutable_framework_id()->MergeFrom(frameworkId); + message.mutable_executor_id()->MergeFrom(executorId); + message.set_status(status.getOrElse(-1)); + + if (master.isSome()) { + send(master.get(), message); + } +} + + // TODO(dhamon): Move these to their own metrics.hpp|cpp. double Slave::_tasks_staging() { http://git-wip-us.apache.org/repos/asf/mesos/blob/fb0e2f1f/src/slave/slave.hpp ---------------------------------------------------------------------- diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp index a4f031c..efe4a54 100644 --- a/src/slave/slave.hpp +++ b/src/slave/slave.hpp @@ -611,6 +611,11 @@ private: const FrameworkID& frameworkId, const Executor* executor); + void sendExitedExecutorMessage( + const FrameworkID& frameworkId, + const ExecutorID& executorId, + const Option<int>& status = None()); + // Forwards the current total of oversubscribed resources. void forwardOversubscribed(); void _forwardOversubscribed(