You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by nn...@apache.org on 2014/07/16 23:31:03 UTC

git commit: Changed healthy status to be sent when task killed after health check.

Repository: mesos
Updated Branches:
  refs/heads/master 049aed3c9 -> 169ec89ff


Changed healthy status to be sent when task killed after health check.

Currently after the health check receives configured amount of task
fails it will initiate a kill task. However currently the task kill
status update doesn't set the healthy field so it's unclear was it
killed because health check or other reasons. This patch sets the health
check field when the task is killed because of failing health checks.

Review: https://reviews.apache.org/r/23520


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/169ec89f
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/169ec89f
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/169ec89f

Branch: refs/heads/master
Commit: 169ec89ffa444c862419b25bb1793a45db29123d
Parents: 049aed3
Author: Timothy Chen <tn...@apache.org>
Authored: Wed Jul 16 14:10:48 2014 -0700
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Wed Jul 16 14:10:48 2014 -0700

----------------------------------------------------------------------
 src/launcher/executor.cpp        | 6 ++++++
 src/tests/health_check_tests.cpp | 1 +
 2 files changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/169ec89f/src/launcher/executor.cpp
----------------------------------------------------------------------
diff --git a/src/launcher/executor.cpp b/src/launcher/executor.cpp
index a573637..7397b65 100644
--- a/src/launcher/executor.cpp
+++ b/src/launcher/executor.cpp
@@ -78,6 +78,7 @@ public:
   CommandExecutorProcess(Option<char**> override, const string& _healthCheckDir)
     : launched(false),
       killed(false),
+      killedByHealthCheck(false),
       pid(-1),
       healthPid(-1),
       escalationTimeout(slave::EXECUTOR_SIGNAL_ESCALATION_TIMEOUT),
@@ -316,6 +317,7 @@ protected:
     driver.get()->sendStatusUpdate(status);
 
     if (initiateTaskKill) {
+      killedByHealthCheck = true;
       killTask(driver.get(), taskID);
     }
   }
@@ -364,6 +366,9 @@ private:
     taskStatus.mutable_task_id()->MergeFrom(taskId);
     taskStatus.set_state(state);
     taskStatus.set_message(message);
+    if (killed && killedByHealthCheck) {
+      taskStatus.set_healthy(false);
+    }
 
     driver->sendStatusUpdate(taskStatus);
 
@@ -440,6 +445,7 @@ private:
 
   bool launched;
   bool killed;
+  bool killedByHealthCheck;
   pid_t pid;
   pid_t healthPid;
   Duration escalationTimeout;

http://git-wip-us.apache.org/repos/asf/mesos/blob/169ec89f/src/tests/health_check_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/health_check_tests.cpp b/src/tests/health_check_tests.cpp
index 44711fd..17e294e 100644
--- a/src/tests/health_check_tests.cpp
+++ b/src/tests/health_check_tests.cpp
@@ -244,6 +244,7 @@ TEST_F(DISABLED_HealthCheckTest, ConsecutiveFailures)
 
   AWAIT_READY(statusKilled);
   EXPECT_EQ(TASK_KILLED, statusKilled.get().state());
+  EXPECT_TRUE(statusKilled.get().has_healthy());
   EXPECT_FALSE(statusKilled.get().healthy());
 
   driver.stop();