You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2014/05/08 21:52:21 UTC

git commit: Introduced a HealthCheck protobuf.

Repository: mesos
Updated Branches:
  refs/heads/master 23d717741 -> d2e404864


Introduced a HealthCheck protobuf.

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


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

Branch: refs/heads/master
Commit: d2e4048643db9aa77fa429c29c08688176c7889f
Parents: 23d7177
Author: Benjamin Hindman <be...@gmail.com>
Authored: Fri May 2 18:39:15 2014 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Thu May 8 12:51:29 2014 -0700

----------------------------------------------------------------------
 include/mesos/mesos.proto | 70 +++++++++++++++++++++++++++++++++++++++---
 src/master/master.cpp     |  2 ++
 2 files changed, 68 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d2e40486/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index bcf841a..a5826d7 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -123,6 +123,61 @@ message FrameworkInfo {
 
 
 /**
+ * Describes a health check for a task or executor (or any arbitrary
+ * process/command). A "strategy" is picked by specifying one of the
+ * optional fields, currently only 'http' is supported. Specifying
+ * more than one strategy is an error.
+ */
+message HealthCheck {
+  // Describes an HTTP health check.
+  message HTTP {
+    // Port to send the HTTP request.
+    required uint32 port = 1;
+
+    // HTTP request path.
+    optional string path = 2 [default = "/"];
+
+    // TODO(benh): Implement:
+    // Whether or not to use HTTPS.
+    // optional bool ssl = 3 [default = false];
+
+    // Expected response statuses. Not specifying any statuses implies
+    // that any returned status is acceptable.
+    repeated uint32 statuses = 4;
+
+    // TODO(benh): Include an 'optional bytes data' field for checking
+    // for specific data in the response.
+  }
+
+  optional HTTP http = 1;
+
+  // TODO(benh): Consider adding a URL health check strategy which
+  // allows doing something similar to the HTTP strategy but
+  // encapsulates all the details in a single string field.
+
+  // TODO(benh): Other possible health check strategies could include
+  // one for TCP/UDP or a "command". A "command" could be running a
+  // (shell) command to check the healthiness. We'd need to determine
+  // what arguments (or environment variables) we'd want to set so
+  // that the command could do it's job (i.e., do we want to expose
+  // the stdout/stderr and/or the pid to make checking for healthiness
+  // easier).
+
+  // Amount of time to wait until starting the health checks.
+  optional double delay_seconds = 2 [default = 15.0];
+
+  // Interval between health checks.
+  optional double interval_seconds = 3 [default = 10.0];
+
+  // Amount of time to wait for the health check to complete.
+  optional double timeout_seconds = 4 [default = 20.0];
+
+  // Number of consecutive failures until considered unhealthy.
+  optional uint32 failures = 5 [default = 3];
+}
+
+
+/**
  * Describes a command, executed via: '/bin/sh -c value'. Any URIs specified
  * are fetched before executing the command.  If the executable field for an
  * uri is set, executable file permission is set on the downloaded file.
@@ -156,18 +211,25 @@ message CommandInfo {
     repeated string options = 2;
   }
 
+  // NOTE: MesosContainerizer does currently not support this
+  // attribute and tasks supplying a 'container' will fail.
+  optional ContainerInfo container = 4;
+
   repeated URI uris = 1;
+
   optional Environment environment = 2;
-  required string value = 3;
 
-  // NOTE: MesosContainerizer does currently not support this attribute
-  // and tasks supplying a 'container' will fail.
-  optional ContainerInfo container = 4;
+  // Actual command (i.e., 'echo hello world').
+  required string value = 3;
 
   // Enables executor and tasks to run as a specific user. If the user
   // field is present both in FrameworkInfo and here, the CommandInfo
   // user value takes precedence.
   optional string user = 5;
+
+  // A health check for the command (currently in *alpha* and initial
+  // support will only be for TaskInfo's that have a CommandInfo).
+  optional HealthCheck health_check = 6;
 }
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/d2e40486/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index bfe48bc..d851a72 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -1823,6 +1823,8 @@ void Master::launchTasks(
   taskVisitors.push_back(new ExecutorInfoChecker());
   taskVisitors.push_back(new CheckpointChecker());
 
+  // TODO(benh): Add a HealthCheckChecker visitor.
+
   // Loop through each task and check it's validity.
   foreach (const TaskInfo& task, tasks) {
     // Possible error found while checking task's validity.