This is an automated email from the ASF dual-hosted git repository. grag pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 3bb8287378bfdbef74288212302d0f2628d51b23 Author: Greg Mann <g...@mesosphere.io> AuthorDate: Mon Jul 15 10:25:49 2019 -0700 Added kill policy to the 'Task' message. Review: https://reviews.apache.org/r/70901/ --- include/mesos/mesos.proto | 4 ++++ include/mesos/type_utils.hpp | 1 + include/mesos/v1/mesos.proto | 4 ++++ src/common/protobuf_utils.cpp | 4 ++++ src/common/type_utils.cpp | 9 ++++++++- 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto index e0a2391..324f686 100644 --- a/include/mesos/mesos.proto +++ b/include/mesos/mesos.proto @@ -2338,6 +2338,10 @@ message Task { // TODO(greggomann): Add the task's `CheckInfo`. See MESOS-8780. + // The kill policy used for this task when it is killed. It's possible for + // this policy to be overridden by the scheduler when killing the task. + optional KillPolicy kill_policy = 16; + // Specific user under which task is running. optional string user = 14; } diff --git a/include/mesos/type_utils.hpp b/include/mesos/type_utils.hpp index b9e6164..2fd8a62 100644 --- a/include/mesos/type_utils.hpp +++ b/include/mesos/type_utils.hpp @@ -63,6 +63,7 @@ bool operator==(const DiscoveryInfo& left, const DiscoveryInfo& right); bool operator==(const Environment& left, const Environment& right); bool operator==(const ExecutorInfo& left, const ExecutorInfo& right); bool operator==(const HealthCheck& left, const HealthCheck& right); +bool operator==(const KillPolicy& left, const KillPolicy& right); bool operator==(const Label& left, const Label& right); bool operator==(const Labels& left, const Labels& right); bool operator==(const MasterInfo& left, const MasterInfo& right); diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto index af29a14..aa9c525 100644 --- a/include/mesos/v1/mesos.proto +++ b/include/mesos/v1/mesos.proto @@ -2327,6 +2327,10 @@ message Task { // TODO(greggomann): Add the task's `CheckInfo`. See MESOS-8780. + // The kill policy used for this task when it is killed. It's possible for + // this policy to be overridden by the scheduler when killing the task. + optional KillPolicy kill_policy = 16; + // Specific user under which task is running. optional string user = 14; } diff --git a/src/common/protobuf_utils.cpp b/src/common/protobuf_utils.cpp index 0112fcb..c91d543 100644 --- a/src/common/protobuf_utils.cpp +++ b/src/common/protobuf_utils.cpp @@ -416,6 +416,10 @@ Task createTask( t.mutable_health_check()->CopyFrom(task.health_check()); } + if (task.has_kill_policy()) { + t.mutable_kill_policy()->CopyFrom(task.kill_policy()); + } + // Copy `user` if set. if (task.has_command() && task.command().has_user()) { t.set_user(task.command().user()); diff --git a/src/common/type_utils.cpp b/src/common/type_utils.cpp index 16d6657..5bf7113 100644 --- a/src/common/type_utils.cpp +++ b/src/common/type_utils.cpp @@ -406,6 +406,12 @@ bool operator==(const HealthCheck& left, const HealthCheck& right) } +bool operator==(const KillPolicy& left, const KillPolicy& right) +{ + return google::protobuf::util::MessageDifferencer::Equals(left, right); +} + + bool operator==(const MasterInfo& left, const MasterInfo& right) { return left.id() == right.id() && @@ -583,7 +589,8 @@ bool operator==(const Task& left, const Task& right) left.discovery() == right.discovery() && left.user() == right.user() && left.container() == right.container() && - left.health_check() == right.health_check(); + left.health_check() == right.health_check() && + left.kill_policy() == right.kill_policy(); }