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/12 16:29:58 UTC

mesos git commit: Fixed default executor handling of nested container status.

Repository: mesos
Updated Branches:
  refs/heads/master f7cf56c0b -> ef0b4bb72


Fixed default executor handling of nested container status.

The default executor was not handling a missing nested container
exit status correctly. It was assuming the protobuf accessor was
returning an Option rather than explicitly checking whether the
`exit_status` field was present in the message.

Added the explicit check for the `exit_status` field, and always
propagated an appropriate message into the status update, even
when the `exit_status` is absent. Added some documentation of
the `exit_status` field to the protobuf definition files.

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


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

Branch: refs/heads/master
Commit: ef0b4bb720208570d9e45b44c6e9795e7dabb9c2
Parents: f7cf56c
Author: James Peach <jp...@apache.org>
Authored: Thu Oct 12 09:17:16 2017 -0700
Committer: James Peach <jp...@apache.org>
Committed: Thu Oct 12 09:17:16 2017 -0700

----------------------------------------------------------------------
 include/mesos/agent/agent.proto    |  4 ++++
 include/mesos/v1/agent/agent.proto |  4 ++++
 src/launcher/default_executor.cpp  | 20 ++++++++++----------
 support/push-commits.py            |  8 +++++++-
 4 files changed, 25 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ef0b4bb7/include/mesos/agent/agent.proto
----------------------------------------------------------------------
diff --git a/include/mesos/agent/agent.proto b/include/mesos/agent/agent.proto
index 7c8c8a7..527bcf2 100644
--- a/include/mesos/agent/agent.proto
+++ b/include/mesos/agent/agent.proto
@@ -333,6 +333,10 @@ message Response {
 
   // Returns termination information about the nested container.
   message WaitNestedContainer {
+    // Wait status of the lead process in the container. Note that this
+    // is the return value of `wait(2)`, so callers must use the `wait(2)`
+    // family of macros to extract whether the process exited cleanly and
+    // what the exit code was.
     optional int32 exit_status = 1;
   }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/ef0b4bb7/include/mesos/v1/agent/agent.proto
----------------------------------------------------------------------
diff --git a/include/mesos/v1/agent/agent.proto b/include/mesos/v1/agent/agent.proto
index 3e19912..be2a2f7 100644
--- a/include/mesos/v1/agent/agent.proto
+++ b/include/mesos/v1/agent/agent.proto
@@ -333,6 +333,10 @@ message Response {
 
   // Returns termination information about the nested container.
   message WaitNestedContainer {
+    // Wait status of the lead process in the container. Note that this
+    // is the return value of `wait(2)`, so callers must use the `wait(2)`
+    // family of macros to extract whether the process exited cleanly and
+    // what the exit code was.
     optional int32 exit_status = 1;
   }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/ef0b4bb7/src/launcher/default_executor.cpp
----------------------------------------------------------------------
diff --git a/src/launcher/default_executor.cpp b/src/launcher/default_executor.cpp
index fd0b1a0..6447b3d 100644
--- a/src/launcher/default_executor.cpp
+++ b/src/launcher/default_executor.cpp
@@ -816,15 +816,16 @@ protected:
     TaskState taskState;
     Option<string> message;
 
-    Option<int> status = waitResponse->wait_nested_container().exit_status();
-
-    if (status.isNone()) {
+    if (!waitResponse->wait_nested_container().has_exit_status()) {
       taskState = TASK_FAILED;
+      message = "Command terminated with unknown status";
     } else {
-      CHECK(WIFEXITED(status.get()) || WIFSIGNALED(status.get()))
-        << "Unexpected wait status " << status.get();
+      int status = waitResponse->wait_nested_container().exit_status();
+
+      CHECK(WIFEXITED(status) || WIFSIGNALED(status))
+        << "Unexpected wait status " << status;
 
-      if (WSUCCEEDED(status.get())) {
+      if (WSUCCEEDED(status)) {
         taskState = TASK_FINISHED;
       } else if (container->killing) {
         // Send TASK_KILLED if the task was killed as a result of
@@ -834,7 +835,7 @@ protected:
         taskState = TASK_FAILED;
       }
 
-      message = "Command " + WSTRINGIFY(status.get());
+      message = "Command " + WSTRINGIFY(status);
     }
 
     TaskStatus taskStatus = createTaskStatus(
@@ -857,9 +858,8 @@ protected:
 
     LOG(INFO)
       << "Child container " << container->containerId << " of task '" << taskId
-      << "' in state " << stringify(taskState) << " "
-      << (status.isSome() ? WSTRINGIFY(status.get())
-                          : "terminated with unknown status");
+      << "' completed in state " << stringify(taskState)
+      << ": " << message.get();
 
     // Shutdown the executor if all the active child containers have terminated.
     if (containers.empty()) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/ef0b4bb7/support/push-commits.py
----------------------------------------------------------------------
diff --git a/support/push-commits.py b/support/push-commits.py
index 210c88e..3e9d05c 100755
--- a/support/push-commits.py
+++ b/support/push-commits.py
@@ -132,7 +132,13 @@ def main():
 
     print 'Pushing commits to', remote
 
-    if not options['dry_run']:
+    if options['dry_run']:
+        check_output(['git',
+                      'push',
+                      '--dry-run',
+                      remote,
+                      'master:master'])
+    else:
         check_output(['git',
                       'push',
                       remote,