Repository: mesos
Updated Branches:
  refs/heads/1.4.x c844db9ac -> b2bf5542d


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/371959c5
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/371959c5
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/371959c5

Branch: refs/heads/1.4.x
Commit: 371959c5709946a8ecb4ecb49eced9612ca4a8fb
Parents: 065a9ca
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:31:26 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/371959c5/src/docker/executor.cpp
----------------------------------------------------------------------
diff --git a/src/docker/executor.cpp b/src/docker/executor.cpp
index 99a6224..5c430dc 100644
--- a/src/docker/executor.cpp
+++ b/src/docker/executor.cpp
@@ -500,9 +500,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
@@ -512,6 +510,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/371959c5/src/launcher/default_executor.cpp
----------------------------------------------------------------------
diff --git a/src/launcher/default_executor.cpp 
b/src/launcher/default_executor.cpp
index 4d30c94..eff7e45 100644
--- a/src/launcher/default_executor.cpp
+++ b/src/launcher/default_executor.cpp
@@ -809,12 +809,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/371959c5/src/launcher/executor.cpp
----------------------------------------------------------------------
diff --git a/src/launcher/executor.cpp b/src/launcher/executor.cpp
index 65b9a2c..12b0326 100644
--- a/src/launcher/executor.cpp
+++ b/src/launcher/executor.cpp
@@ -909,12 +909,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;
       }

Reply via email to