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 2017/10/15 22:48:51 UTC
[7/9] mesos git commit: Propagated new wait response fields from the
default executor.
Propagated new wait response fields from the default executor.
In the default executor, propagate newly added `WaitNestedContainer`
response fields to the corresponding status update. This allows
frameworks to receive more reliable information about nested
container failures.
Review: https://reviews.apache.org/r/62646/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6b703932
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6b703932
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6b703932
Branch: refs/heads/master
Commit: 6b7039323ae434211ac977d14e3c21a966566f58
Parents: 4dd9ad6
Author: James Peach <jp...@apache.org>
Authored: Sun Oct 15 15:21:53 2017 -0700
Committer: James Peach <jp...@apache.org>
Committed: Sun Oct 15 15:21:53 2017 -0700
----------------------------------------------------------------------
src/launcher/default_executor.cpp | 40 +++++++++++++++++++++++++++++++---
1 file changed, 37 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/6b703932/src/launcher/default_executor.cpp
----------------------------------------------------------------------
diff --git a/src/launcher/default_executor.cpp b/src/launcher/default_executor.cpp
index a376c09..e58766f 100644
--- a/src/launcher/default_executor.cpp
+++ b/src/launcher/default_executor.cpp
@@ -799,6 +799,8 @@ protected:
TaskState taskState;
Option<string> message;
+ Option<TaskStatus::Reason> reason;
+ Option<TaskResourceLimitation> limitation;
if (!waitResponse->wait_nested_container().has_exit_status()) {
taskState = TASK_FAILED;
@@ -822,11 +824,38 @@ protected:
message = "Command " + WSTRINGIFY(status);
}
+ // Note that we always prefer the task state and reason from the
+ // agent response over what we can determine ourselves because
+ // in general, the agent has more specific information about why
+ // the container exited (e.g. this might be a container resource
+ // limitation).
+ if (waitResponse->wait_nested_container().has_state()) {
+ taskState = waitResponse->wait_nested_container().state();
+ }
+
+ if (waitResponse->wait_nested_container().has_reason()) {
+ reason = waitResponse->wait_nested_container().reason();
+ }
+
+ if (waitResponse->wait_nested_container().has_message()) {
+ if (message.isSome()) {
+ message->append(
+ ": " + waitResponse->wait_nested_container().message());
+ } else {
+ message = waitResponse->wait_nested_container().message();
+ }
+ }
+
+ if (waitResponse->wait_nested_container().has_limitation()) {
+ limitation = waitResponse->wait_nested_container().limitation();
+ }
+
TaskStatus taskStatus = createTaskStatus(
taskId,
taskState,
- None(),
- message);
+ reason,
+ message,
+ limitation);
// Indicate that a task has been unhealthy upon termination.
if (unhealthy) {
@@ -1241,7 +1270,8 @@ private:
const TaskID& taskId,
const TaskState& state,
const Option<TaskStatus::Reason>& reason = None(),
- const Option<string>& message = None())
+ const Option<string>& message = None(),
+ const Option<TaskResourceLimitation>& limitation = None())
{
TaskStatus status = protobuf::createTaskStatus(
taskId,
@@ -1260,6 +1290,10 @@ private:
status.set_message(message.get());
}
+ if (limitation.isSome()) {
+ status.mutable_limitation()->CopyFrom(limitation.get());
+ }
+
CHECK(containers.contains(taskId));
const Owned<Container>& container = containers.at(taskId);