You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jp...@apache.org on 2018/05/03 16:16:31 UTC
[2/8] mesos git commit: Added a validation that `max_completion_time`
must be non-negative.
Added a validation that `max_completion_time` must be non-negative.
Review: https://reviews.apache.org/r/66591/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/95bf46b9
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/95bf46b9
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/95bf46b9
Branch: refs/heads/master
Commit: 95bf46b9a114c5e37a45802f962414ef60ca2fc6
Parents: 835f52b
Author: Zhitao Li <zh...@gmail.com>
Authored: Thu May 3 08:33:08 2018 -0700
Committer: James Peach <jp...@apache.org>
Committed: Thu May 3 08:33:08 2018 -0700
----------------------------------------------------------------------
src/master/validation.cpp | 13 +++++++++++++
src/master/validation.hpp | 3 +++
2 files changed, 16 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/95bf46b9/src/master/validation.cpp
----------------------------------------------------------------------
diff --git a/src/master/validation.cpp b/src/master/validation.cpp
index ac2e1bb..15dfa8a 100644
--- a/src/master/validation.cpp
+++ b/src/master/validation.cpp
@@ -1187,6 +1187,18 @@ Option<Error> validateKillPolicy(const TaskInfo& task)
}
+Option<Error> validateMaxCompletionTime(const TaskInfo& task)
+{
+ if (task.has_max_completion_time() &&
+ Nanoseconds(task.max_completion_time().nanoseconds()) <
+ Duration::zero()) {
+ return Error("Task's `max_completion_time` must be non-negative");
+ }
+
+ return None();
+}
+
+
Option<Error> validateCheck(const TaskInfo& task)
{
if (task.has_check()) {
@@ -1321,6 +1333,7 @@ Option<Error> validateTask(
lambda::bind(internal::validateUniqueTaskID, task, framework),
lambda::bind(internal::validateSlaveID, task, slave),
lambda::bind(internal::validateKillPolicy, task),
+ lambda::bind(internal::validateMaxCompletionTime, task),
lambda::bind(internal::validateCheck, task),
lambda::bind(internal::validateHealthCheck, task),
lambda::bind(internal::validateResources, task),
http://git-wip-us.apache.org/repos/asf/mesos/blob/95bf46b9/src/master/validation.hpp
----------------------------------------------------------------------
diff --git a/src/master/validation.hpp b/src/master/validation.hpp
index 7c129ce..c1ab754 100644
--- a/src/master/validation.hpp
+++ b/src/master/validation.hpp
@@ -189,6 +189,9 @@ Option<Error> validateTaskAndExecutorResources(const TaskInfo& task);
// Validates the kill policy of the task.
Option<Error> validateKillPolicy(const TaskInfo& task);
+// Validates `max_completion_time` of the task.
+Option<Error> validateMaxCompletionTime(const TaskInfo& task);
+
// Validates the check of the task.
Option<Error> validateCheck(const TaskInfo& task);