Always send TASK_KILLED when the task is killed by a framework. This change is done for command, docker and default executors.
Review: https://reviews.apache.org/r/62326 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b320e2fc Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b320e2fc Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b320e2fc Branch: refs/heads/1.3.x Commit: b320e2fc73498f97931aa48785a22ae90a33b4de Parents: 5da5ace Author: Qian Zhang <zhq527...@gmail.com> Authored: Thu Sep 14 17:29:39 2017 +0800 Committer: Qian Zhang <zhq527...@gmail.com> Committed: Tue Nov 14 17:26:23 2017 +0800 ---------------------------------------------------------------------- src/docker/executor.cpp | 6 +++--- src/launcher/default_executor.cpp | 6 +++--- src/launcher/executor.cpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/b320e2fc/src/docker/executor.cpp ---------------------------------------------------------------------- diff --git a/src/docker/executor.cpp b/src/docker/executor.cpp index c6f50fa..79cd4e5 100644 --- a/src/docker/executor.cpp +++ b/src/docker/executor.cpp @@ -495,9 +495,7 @@ private: CHECK(WIFEXITED(status) || WIFSIGNALED(status)) << "Unexpected wait status " << status; - if (WSUCCEEDED(status)) { - state = TASK_FINISHED; - } else if (killed) { + if (killed) { // Send TASK_KILLED if the task was killed as a result of // kill() or shutdown(). Note that in general there is a // race between signaling the container and it terminating @@ -507,6 +505,8 @@ private: // determine whether the container was terminated via // our signal or terminated on its own. state = TASK_KILLED; + } else if (WSUCCEEDED(status)) { + state = TASK_FINISHED; } else { state = TASK_FAILED; } http://git-wip-us.apache.org/repos/asf/mesos/blob/b320e2fc/src/launcher/default_executor.cpp ---------------------------------------------------------------------- diff --git a/src/launcher/default_executor.cpp b/src/launcher/default_executor.cpp index 81aa6e4..3c6f220 100644 --- a/src/launcher/default_executor.cpp +++ b/src/launcher/default_executor.cpp @@ -773,12 +773,12 @@ protected: CHECK(WIFEXITED(status) || WIFSIGNALED(status)) << "Unexpected wait status " << status; - if (WSUCCEEDED(status)) { - taskState = TASK_FINISHED; - } else if (container->killing) { + if (container->killing) { // Send TASK_KILLED if the task was killed as a result of // `killTask()` or `shutdown()`. taskState = TASK_KILLED; + } else if (WSUCCEEDED(status)) { + taskState = TASK_FINISHED; } else { taskState = TASK_FAILED; } http://git-wip-us.apache.org/repos/asf/mesos/blob/b320e2fc/src/launcher/executor.cpp ---------------------------------------------------------------------- diff --git a/src/launcher/executor.cpp b/src/launcher/executor.cpp index b05f73e..61c1512 100644 --- a/src/launcher/executor.cpp +++ b/src/launcher/executor.cpp @@ -891,12 +891,12 @@ private: CHECK(WIFEXITED(status) || WIFSIGNALED(status)) << "Unexpected wait status " << status; - if (WSUCCEEDED(status)) { - taskState = TASK_FINISHED; - } else if (killed) { + if (killed) { // Send TASK_KILLED if the task was killed as a result of // kill() or shutdown(). taskState = TASK_KILLED; + } else if (WSUCCEEDED(status)) { + taskState = TASK_FINISHED; } else { taskState = TASK_FAILED; }