You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2016/03/24 18:24:33 UTC

[8/9] mesos git commit: Introduced `KillPolicy` protobuf.

Introduced `KillPolicy` protobuf.

Describes a kill policy for a task. Currently does not express
different policies (e.g. hitting HTTP endpoints), only controls
how long to wait between graceful and forcible task kill.

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


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

Branch: refs/heads/master
Commit: 7ab6a478b9cef548a2470d18bd281aee5610b62a
Parents: 201ab8f
Author: Alexander Rukletsov <ru...@gmail.com>
Authored: Thu Mar 24 17:30:31 2016 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Thu Mar 24 18:21:03 2016 +0100

----------------------------------------------------------------------
 CHANGELOG                    | 11 +++++++++++
 include/mesos/mesos.proto    | 39 +++++++++++++++++++++++++++++++++++++--
 include/mesos/v1/mesos.proto | 39 +++++++++++++++++++++++++++++++++++++--
 3 files changed, 85 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/7ab6a478/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 5aeb479..e28dbb6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,17 @@
 Release Notes - Mesos - Version 0.29.0 (WIP)
 --------------------------------------------
 This release contains the following new features:
+  * [MESOS-4909] - Tasks can now specify a kill policy. They are best-effort,
+    because machine failures or forcible terminations may occur. Currently, the
+    only available kill policy is how long to wait between graceful and forcible
+    task kill. In the future, more policies may be available (e.g. hitting an
+    HTTP endpoint, running a command, etc). Note that it is the executor's
+    responsibility to enforce kill policies. For executor-less command-based
+    tasks, the kill is performed via sending a signal to the task process:
+    SIGTERM for the graceful kill and SIGKILL for the forcible kill. For docker
+    executor-less tasks the grace period is passed to 'docker stop --time'. This
+    feature supersedes the '--docker_stop_timeout', which is now deprecated.
+
   * [MESOS-4949] - The executor shutdown grace period can now be configured in
     `ExecutorInfo`, which overrides the agent flag. When shutting down an
     executor the agent will wait in a best-effort manner for the grace period

http://git-wip-us.apache.org/repos/asf/mesos/blob/7ab6a478/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index ade6f5a..82a9550 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -351,6 +351,35 @@ message HealthCheck {
 
 
 /**
+ * Describes a kill policy for a task. Currently does not express
+ * different policies (e.g. hitting HTTP endpoints), only controls
+ * how long to wait between graceful and forcible task kill:
+ *
+ *     graceful kill --------------> forcible kill
+ *                    grace_period
+ *
+ * Kill policies are best-effort, because machine failures / forcible
+ * terminations may occur.
+ *
+ * NOTE: For executor-less command-based tasks, the kill is performed
+ * via sending a signal to the task process: SIGTERM for the graceful
+ * kill and SIGKILL for the forcible kill.
+ */
+message KillPolicy {
+  // The grace period specifies how long to wait before forcibly
+  // killing the task. It is recommended to attempt to gracefully
+  // kill the task (and send TASK_KILLING) to indicate that the
+  // graceful kill is in progress. Once the grace period elapses,
+  // if the task has not terminated, a forcible kill should occur.
+  // The task should not assume that it will always be allotted
+  // the full grace period. For example, the executor may be
+  // shutdown more quickly by the agent, or failures / forcible
+  // terminations may occur.
+  optional DurationInfo grace_period = 1;
+}
+
+
+/**
  * 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.
@@ -1215,10 +1244,16 @@ message TaskInfo {
   // of this task paired with the task's CommandInfo.
   optional ContainerInfo container = 9;
 
-  // A health check for the task, currently only supported for
-  // command tasks (i.e. `CommandInfo` is set).
+  // A health check for the task. Implemented for executor-less
+  // command-based tasks. For tasks that specify an executor, it is
+  // the executor's responsibility to implement the health checking.
   optional HealthCheck health_check = 8;
 
+  // A kill policy for the task. Implemented for executor-less
+  // command-based tasks. For tasks that specify an executor, it is
+  // the executor's responsibility to implement the kill policy.
+  optional KillPolicy kill_policy = 12;
+
   optional bytes data = 6;
 
   // Labels are free-form key value pairs which are exposed through

http://git-wip-us.apache.org/repos/asf/mesos/blob/7ab6a478/include/mesos/v1/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto
index 7a5b680..bec00ad 100644
--- a/include/mesos/v1/mesos.proto
+++ b/include/mesos/v1/mesos.proto
@@ -351,6 +351,35 @@ message HealthCheck {
 
 
 /**
+ * Describes a kill policy for a task. Currently does not express
+ * different policies (e.g. hitting HTTP endpoints), only controls
+ * how long to wait between graceful and forcible task kill:
+ *
+ *     graceful kill --------------> forcible kill
+ *                    grace_period
+ *
+ * Kill policies are best-effort, because machine failures / forcible
+ * terminations may occur.
+ *
+ * NOTE: For executor-less command-based tasks, the kill is performed
+ * via sending a signal to the task process: SIGTERM for the graceful
+ * kill and SIGKILL for the forcible kill.
+ */
+message KillPolicy {
+  // The grace period specifies how long to wait before forcibly
+  // killing the task. It is recommended to attempt to gracefully
+  // kill the task (and send TASK_KILLING) to indicate that the
+  // graceful kill is in progress. Once the grace period elapses,
+  // if the task has not terminated, a forcible kill should occur.
+  // The task should not assume that it will always be allotted
+  // the full grace period. For example, the executor may be
+  // shutdown more quickly by the agent, or failures / forcible
+  // terminations may occur.
+  optional DurationInfo grace_period = 1;
+}
+
+
+/**
  * 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.
@@ -1214,10 +1243,16 @@ message TaskInfo {
   // of this task paired with the task's CommandInfo.
   optional ContainerInfo container = 9;
 
-  // A health check for the task, currently only supported for
-  // command tasks (i.e. `CommandInfo` is set).
+  // A health check for the task. Implemented for executor-less
+  // command-based tasks. For tasks that specify an executor, it is
+  // the executor's responsibility to implement the health checking.
   optional HealthCheck health_check = 8;
 
+  // A kill policy for the task. Implemented for executor-less
+  // command-based tasks. For tasks that specify an executor, it is
+  // the executor's responsibility to implement the kill policy.
+  optional KillPolicy kill_policy = 12;
+
   optional bytes data = 6;
 
   // Labels are free-form key value pairs which are exposed through