You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/08/15 22:25:29 UTC

[3/4] mesos git commit: Added LAUNCH_GROUP offer operation.

Added LAUNCH_GROUP offer operation.

A scheduler can use the LAUNCH_GROUP offer operation to send a
`TaskGroup` to an executor.

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


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

Branch: refs/heads/master
Commit: a43b015dabfb4b91378a8fe14b6a6d8d59c13fe7
Parents: d3adee2
Author: Vinod Kone <vi...@gmail.com>
Authored: Fri Aug 12 11:41:52 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Mon Aug 15 15:25:05 2016 -0700

----------------------------------------------------------------------
 include/mesos/mesos.proto    | 36 ++++++++++++++++++++++++++++++++++--
 include/mesos/v1/mesos.proto | 36 ++++++++++++++++++++++++++++++++++--
 src/common/resources.cpp     |  4 ++++
 src/master/master.cpp        | 12 ++++++++++++
 src/v1/resources.cpp         |  4 ++++
 5 files changed, 88 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/a43b015d/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index 0326a5c..53b6547 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -518,7 +518,8 @@ message ExecutorInfo {
     //    and 32 MB memory will be used; schedulers should account for these
     //    resources when accepting offers.
     //
-    // 3) Default executor only accepts a *single* launch operation.
+    // 3) Default executor only accepts a *single* `LAUNCH` or `LAUNCH_GROUP`
+    //    offer operation.
     DEFAULT = 1;
 
     // For frameworks that need custom functionality to run tasks, a `CUSTOM`
@@ -529,7 +530,8 @@ message ExecutorInfo {
 
   // For backwards compatibility, if this field is not set when using `LAUNCH`
   // offer operation, Mesos will infer the type by checking if `command` is
-  // set (`CUSTOM`) or unset (`DEFAULT`).
+  // set (`CUSTOM`) or unset (`DEFAULT`). `type` must be set when using
+  // `LAUNCH_GROUP` offer operation.
   //
   // TODO(vinod): Add support for explicitly setting `type` to `DEFAULT `
   // in `LAUNCH` offer operation.
@@ -1254,16 +1256,31 @@ message Offer {
     enum Type {
       UNKNOWN = 0;
       LAUNCH = 1;
+      LAUNCH_GROUP = 6;
       RESERVE = 2;
       UNRESERVE = 3;
       CREATE = 4;
       DESTROY = 5;
     }
 
+    // TODO(vinod): Deprecate this in favor of `LaunchGroup` below.
     message Launch {
       repeated TaskInfo task_infos = 1;
     }
 
+    // Unlike `Launch` above, all the tasks in a `task_group` are
+    // atomically delivered to an executor.
+    //
+    // `NetworkInfo` set on executor will be shared by all tasks in
+    // the task group.
+    //
+    // TODO(vinod): Any volumes set on executor could be used by a
+    // task by explicitly setting `Volume.source` in its resources.
+    message LaunchGroup {
+      required ExecutorInfo executor = 1;
+      required TaskGroupInfo task_group = 2;
+    }
+
     message Reserve {
       repeated Resource resources = 1;
     }
@@ -1282,6 +1299,7 @@ message Offer {
 
     optional Type type = 1;
     optional Launch launch = 2;
+    optional LaunchGroup launch_group = 7;
     optional Reserve reserve = 3;
     optional Unreserve unreserve = 4;
     optional Create create = 5;
@@ -1389,6 +1407,20 @@ message TaskInfo {
 }
 
 
+/**
+ * Describes a group of tasks that belong to an executor. The
+ * executor will receive the task group in a single message to
+ * allow the group to be launched "atomically".
+ *
+ * NOTES:
+ * 1) `TaskInfo.executor` must not be set.
+ * 2) `NetworkInfo` must not be set inside task's `ContainerInfo`.
+ */
+message TaskGroupInfo {
+  repeated TaskInfo tasks = 1;
+}
+
+
 // TODO(bmahler): Add executor_uuid here, and send it to the master. This will
 // allow us to expose executor work directories for tasks in the webui when
 // looking from the master level. Currently only the slave knows which run the

http://git-wip-us.apache.org/repos/asf/mesos/blob/a43b015d/include/mesos/v1/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto
index fa29335..f6b59e1 100644
--- a/include/mesos/v1/mesos.proto
+++ b/include/mesos/v1/mesos.proto
@@ -518,7 +518,8 @@ message ExecutorInfo {
     //    and 32 MB memory will be used; schedulers should account for these
     //    resources when accepting offers.
     //
-    // 3) Default executor only accepts a *single* launch operation.
+    // 3) Default executor only accepts a *single* `LAUNCH` or `LAUNCH_GROUP`
+    //    offer operation.
     DEFAULT = 1;
 
     // For frameworks that need custom functionality to run tasks, a `CUSTOM`
@@ -529,7 +530,8 @@ message ExecutorInfo {
 
   // For backwards compatibility, if this field is not set when using `LAUNCH`
   // offer operation, Mesos will infer the type by checking if `command` is
-  // set (`CUSTOM`) or unset (`DEFAULT`).
+  // set (`CUSTOM`) or unset (`DEFAULT`). `type` must be set when using
+  // `LAUNCH_GROUP` offer operation.
   //
   // TODO(vinod): Add support for explicitly setting `type` to `DEFAULT `
   // in `LAUNCH` offer operation.
@@ -1253,16 +1255,31 @@ message Offer {
     enum Type {
       UNKNOWN = 0;
       LAUNCH = 1;
+      LAUNCH_GROUP = 6;
       RESERVE = 2;
       UNRESERVE = 3;
       CREATE = 4;
       DESTROY = 5;
     }
 
+    // TODO(vinod): Deprecate this in favor of `LaunchGroup` below.
     message Launch {
       repeated TaskInfo task_infos = 1;
     }
 
+    // Unlike `Launch` above, all the tasks in a `task_group` are
+    // atomically delivered to an executor.
+    //
+    // `NetworkInfo` set on executor will be shared by all tasks in
+    // the task group.
+    //
+    // TODO(vinod): Any volumes set on executor could be used by a
+    // task by explicitly setting `Volume.source` in its resources.
+    message LaunchGroup {
+      required ExecutorInfo executor = 1;
+      required TaskGroupInfo task_group = 2;
+    }
+
     message Reserve {
       repeated Resource resources = 1;
     }
@@ -1281,6 +1298,7 @@ message Offer {
 
     optional Type type = 1;
     optional Launch launch = 2;
+    optional LaunchGroup launch_group = 7;
     optional Reserve reserve = 3;
     optional Unreserve unreserve = 4;
     optional Create create = 5;
@@ -1388,6 +1406,20 @@ message TaskInfo {
 }
 
 
+/**
+ * Describes a group of tasks that belong to an executor. The
+ * executor will receive the task group in a single message to
+ * allow the group to be launched "atomically".
+ *
+ * NOTES:
+ * 1) `TaskInfo.executor` must not be set.
+ * 2) `NetworkInfo` must not be set inside task's `ContainerInfo`.
+ */
+message TaskGroupInfo {
+  repeated TaskInfo tasks = 1;
+}
+
+
 // TODO(bmahler): Add executor_uuid here, and send it to the master. This will
 // allow us to expose executor work directories for tasks in the webui when
 // looking from the master level. Currently only the agent knows which run the

http://git-wip-us.apache.org/repos/asf/mesos/blob/a43b015d/src/common/resources.cpp
----------------------------------------------------------------------
diff --git a/src/common/resources.cpp b/src/common/resources.cpp
index f180a0f..96b4c39 100644
--- a/src/common/resources.cpp
+++ b/src/common/resources.cpp
@@ -1109,6 +1109,10 @@ Try<Resources> Resources::apply(const Offer::Operation& operation) const
       // Launch operation does not alter the offered resources.
       break;
 
+    case Offer::Operation::LAUNCH_GROUP:
+      // LaunchGroup operation does not alter the offered resources.
+      break;
+
     case Offer::Operation::RESERVE: {
       Option<Error> error = validate(operation.reserve().resources());
       if (error.isSome()) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/a43b015d/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 33c2ba1..d94a851 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -3369,6 +3369,12 @@ void Master::accept(
         break;
       }
 
+      case Offer::Operation::LAUNCH_GROUP : {
+        // TODO(vinod): Implement this.
+        LOG(WARNING) << "Ignoring unimplemented LAUNCH_GROUP operation";
+        break;
+      }
+
       // NOTE: When handling RESERVE and UNRESERVE operations, authorization
       // will proceed even if no principal is specified, although currently
       // resources cannot be reserved or unreserved unless a principal is
@@ -3867,6 +3873,12 @@ void Master::_accept(
         break;
       }
 
+      case Offer::Operation::LAUNCH_GROUP : {
+        // TODO(vinod): Implement this.
+        LOG(WARNING) << "Ignoring unimplemented LAUNCH_GROUP operation";
+        break;
+      }
+
       case Offer::Operation::UNKNOWN: {
         LOG(ERROR) << "Ignoring unknown offer operation";
         break;

http://git-wip-us.apache.org/repos/asf/mesos/blob/a43b015d/src/v1/resources.cpp
----------------------------------------------------------------------
diff --git a/src/v1/resources.cpp b/src/v1/resources.cpp
index 4948b21..3cc7580 100644
--- a/src/v1/resources.cpp
+++ b/src/v1/resources.cpp
@@ -1112,6 +1112,10 @@ Try<Resources> Resources::apply(const Offer::Operation& operation) const
       // Launch operation does not alter the offered resources.
       break;
 
+    case Offer::Operation::LAUNCH_GROUP:
+      // LaunchGroup operation does not alter the offered resources.
+      break;
+
     case Offer::Operation::RESERVE: {
       Option<Error> error = validate(operation.reserve().resources());
       if (error.isSome()) {