Repository: mesos Updated Branches: refs/heads/master 212b88c4d -> 63a7a7928
Added validations performed in the MesosExecutorDriver to the Slave. Copies validations made to the messages exchanged between the slave and the `MesosExecutorDriver` and performed in the executor driver to the slave. This is requiered since the new HTTP API will deprecate the executor driver. Review: https://reviews.apache.org/r/31538 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/63a7a792 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/63a7a792 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/63a7a792 Branch: refs/heads/master Commit: 63a7a792866b2ae09aa71fa8ad63b2540a9a52dc Parents: 212b88c Author: Alexander Rojas <[email protected]> Authored: Wed Mar 25 11:39:13 2015 +0100 Committer: Till Toenshoff <[email protected]> Committed: Wed Mar 25 11:39:14 2015 +0100 ---------------------------------------------------------------------- src/exec/exec.cpp | 18 ------------------ src/slave/slave.cpp | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/63a7a792/src/exec/exec.cpp ---------------------------------------------------------------------- diff --git a/src/exec/exec.cpp b/src/exec/exec.cpp index d678f06..a22e8bb 100644 --- a/src/exec/exec.cpp +++ b/src/exec/exec.cpp @@ -489,24 +489,6 @@ protected: void sendStatusUpdate(const TaskStatus& status) { - if (status.state() == TASK_STAGING) { - LOG(ERROR) << "Executor is not allowed to send " - << "TASK_STAGING status update. Aborting!"; - - driver->abort(); - - Stopwatch stopwatch; - if (FLAGS_v >= 1) { - stopwatch.start(); - } - - executor->error(driver, "Attempted to send TASK_STAGING status update"); - - VLOG(1) << "Executor::error took " << stopwatch.elapsed(); - - return; - } - StatusUpdateMessage message; StatusUpdate* update = message.mutable_update(); update->mutable_framework_id()->MergeFrom(frameworkId); http://git-wip-us.apache.org/repos/asf/mesos/blob/63a7a792/src/slave/slave.cpp ---------------------------------------------------------------------- diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp index c7e65a6..31ca724 100644 --- a/src/slave/slave.cpp +++ b/src/slave/slave.cpp @@ -2542,6 +2542,22 @@ void Slave::statusUpdate(StatusUpdate update, const UPID& pid) executor->state == Executor::TERMINATED) << executor->state; + // Failing this validation on the executor driver used to cause the + // driver to abort. Now that the validation is done by the slave, it + // should shutdown the executor to be consistent. + // TODO(arojas): Once the HTTP API is the default, return a + // 400 Bad Request response, indicating the reason in the body. + if (status.source() == TaskStatus::SOURCE_EXECUTOR && + status.state() == TASK_STAGING) { + LOG(ERROR) << "Received TASK_STAGING from executor " << executor->pid + << " of framework " << update.framework_id() + << " which is not allowed. Shutting down the executor"; + + shutdownExecutor(framework, executor); + + return; + } + // TODO(vinod): Revisit these semantics when we disallow executors // from sending updates for tasks that belong to other executors. if (pid != UPID() && executor->pid != pid) {
