Repository: mesos Updated Branches: refs/heads/master fc5f86ab0 -> 40115df30
Added LAUNCH_GROUP event to executor API. This event is used to deliver a task group atomically to an executor. Review: https://reviews.apache.org/r/51062 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/40115df3 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/40115df3 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/40115df3 Branch: refs/heads/master Commit: 40115df3021cf0951cb3c9925cd979819d438e3a Parents: a43b015 Author: Vinod Kone <vinodk...@gmail.com> Authored: Fri Aug 12 15:41:01 2016 -0700 Committer: Vinod Kone <vinodk...@gmail.com> Committed: Mon Aug 15 15:25:05 2016 -0700 ---------------------------------------------------------------------- include/mesos/executor/executor.proto | 9 +++++++++ include/mesos/v1/executor/executor.proto | 9 +++++++++ src/examples/long_lived_executor.cpp | 5 +++++ src/examples/test_http_executor.cpp | 6 ++++++ src/launcher/executor.cpp | 9 +++++++++ src/tests/mesos.hpp | 3 +++ 6 files changed, 41 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/40115df3/include/mesos/executor/executor.proto ---------------------------------------------------------------------- diff --git a/include/mesos/executor/executor.proto b/include/mesos/executor/executor.proto index 9aa046e..0d31406 100644 --- a/include/mesos/executor/executor.proto +++ b/include/mesos/executor/executor.proto @@ -40,6 +40,7 @@ message Event { SUBSCRIBED = 1; // See 'Subscribed' below. LAUNCH = 2; // See 'Launch' below. + LAUNCH_GROUP = 8; // See 'LaunchGroup' below. KILL = 3; // See 'Kill' below. ACKNOWLEDGED = 4; // See 'Acknowledged' below. MESSAGE = 5; // See 'Message' below. @@ -80,6 +81,13 @@ message Event { required TaskInfo task = 1; } + // Received when the framework attempts to launch a group of tasks atomically. + // Similar to `Launch` above the executor must send TASK_RUNNING updates for + // tasks that are successfully launched. + message LaunchGroup { + required TaskGroupInfo task_group = 1; + } + // Received when the scheduler wants to kill a specific task. Once // the task is terminated, the executor should send a TASK_KILLED // (or TASK_FAILED) update. The terminal update is necessary so @@ -129,6 +137,7 @@ message Event { optional Subscribed subscribed = 2; optional Acknowledged acknowledged = 3; optional Launch launch = 4; + optional LaunchGroup launch_group = 8; optional Kill kill = 5; optional Message message = 6; optional Error error = 7; http://git-wip-us.apache.org/repos/asf/mesos/blob/40115df3/include/mesos/v1/executor/executor.proto ---------------------------------------------------------------------- diff --git a/include/mesos/v1/executor/executor.proto b/include/mesos/v1/executor/executor.proto index 5e76e4e..0783596 100644 --- a/include/mesos/v1/executor/executor.proto +++ b/include/mesos/v1/executor/executor.proto @@ -40,6 +40,7 @@ message Event { SUBSCRIBED = 1; // See 'Subscribed' below. LAUNCH = 2; // See 'Launch' below. + LAUNCH_GROUP = 8; // See 'LaunchGroup' below. KILL = 3; // See 'Kill' below. ACKNOWLEDGED = 4; // See 'Acknowledged' below. MESSAGE = 5; // See 'Message' below. @@ -80,6 +81,13 @@ message Event { required TaskInfo task = 1; } + // Received when the framework attempts to launch a group of tasks atomically. + // Similar to `Launch` above the executor must send TASK_RUNNING updates for + // tasks that are successfully launched. + message LaunchGroup { + required TaskGroupInfo task_group = 1; + } + // Received when the scheduler wants to kill a specific task. Once // the task is terminated, the executor should send a TASK_KILLED // (or TASK_FAILED) update. The terminal update is necessary so @@ -130,6 +138,7 @@ message Event { optional Subscribed subscribed = 2; optional Acknowledged acknowledged = 3; optional Launch launch = 4; + optional LaunchGroup launch_group = 8; optional Kill kill = 5; optional Message message = 6; optional Error error = 7; http://git-wip-us.apache.org/repos/asf/mesos/blob/40115df3/src/examples/long_lived_executor.cpp ---------------------------------------------------------------------- diff --git a/src/examples/long_lived_executor.cpp b/src/examples/long_lived_executor.cpp index 5c1fde1..65fc9af 100644 --- a/src/examples/long_lived_executor.cpp +++ b/src/examples/long_lived_executor.cpp @@ -111,6 +111,11 @@ protected: break; } + case Event::LAUNCH_GROUP: { + // TODO(vinod): Implement this. + break; + } + case Event::ACKNOWLEDGED: { // Remove the corresponding update. updates.erase(UUID::fromBytes(event.acknowledged().uuid()).get()); http://git-wip-us.apache.org/repos/asf/mesos/blob/40115df3/src/examples/test_http_executor.cpp ---------------------------------------------------------------------- diff --git a/src/examples/test_http_executor.cpp b/src/examples/test_http_executor.cpp index 19d0f68..b9b6bfd 100644 --- a/src/examples/test_http_executor.cpp +++ b/src/examples/test_http_executor.cpp @@ -158,6 +158,12 @@ public: break; } + case Event::LAUNCH_GROUP: { + cout << "Received a LAUNCH_GROUP event"; + // TODO(vinod): Implement this. + break; + } + case Event::KILL: { cout << "Received a KILL event" << endl; break; http://git-wip-us.apache.org/repos/asf/mesos/blob/40115df3/src/launcher/executor.cpp ---------------------------------------------------------------------- diff --git a/src/launcher/executor.cpp b/src/launcher/executor.cpp index 2d04edb..71ede1e 100644 --- a/src/launcher/executor.cpp +++ b/src/launcher/executor.cpp @@ -195,6 +195,15 @@ public: break; } + case Event::LAUNCH_GROUP: { + cerr << "LAUNCH_GROUP event is not supported" << endl; + // Shut down because this is unexpected; `LAUNCH_GROUP` event + // should only ever go to a group-capable default executor and + // not the command executor. + shutdown(); + break; + } + case Event::KILL: { Option<KillPolicy> override = event.kill().has_kill_policy() ? Option<KillPolicy>(event.kill().kill_policy()) http://git-wip-us.apache.org/repos/asf/mesos/blob/40115df3/src/tests/mesos.hpp ---------------------------------------------------------------------- diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp index 3a1860d..4cae54b 100644 --- a/src/tests/mesos.hpp +++ b/src/tests/mesos.hpp @@ -1158,6 +1158,9 @@ public: case Event::LAUNCH: launch(mesos, event.launch()); break; + case Event::LAUNCH_GROUP: + // TODO(vinod): Implement this. + break; case Event::KILL: kill(mesos, event.kill()); break;