You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2017/03/15 21:21:13 UTC
[12/13] mesos git commit: Added comments regarding exit status on
Windows vs. Posix.
Added comments regarding exit status on Windows vs. Posix.
Review: https://reviews.apache.org/r/57597
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/4f009180
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/4f009180
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/4f009180
Branch: refs/heads/master
Commit: 4f009180730babe782d15bd0bbc289c91e5a5b2e
Parents: 11160d6
Author: Alexander Rukletsov <al...@apache.org>
Authored: Tue Mar 14 14:29:05 2017 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Wed Mar 15 22:20:20 2017 +0100
----------------------------------------------------------------------
include/mesos/mesos.proto | 4 +++-
include/mesos/scheduler/scheduler.proto | 10 ++++++++++
include/mesos/v1/mesos.proto | 4 +++-
include/mesos/v1/scheduler/scheduler.proto | 10 ++++++++++
src/checks/checker.cpp | 6 ++++++
5 files changed, 32 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/4f009180/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index a432ead..9a66967 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -1736,7 +1736,9 @@ enum TaskState {
*/
message CheckStatusInfo {
message Command {
- // Exit code of a command check.
+ // Exit code of a command check. It is the result of calling
+ // `WEXITSTATUS()` on `waitpid()` termination information on
+ // Posix and calling `GetExitCodeProcess()` on Windows.
optional int32 exit_code = 1;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/4f009180/include/mesos/scheduler/scheduler.proto
----------------------------------------------------------------------
diff --git a/include/mesos/scheduler/scheduler.proto b/include/mesos/scheduler/scheduler.proto
index 0f6803a..cee0a17 100644
--- a/include/mesos/scheduler/scheduler.proto
+++ b/include/mesos/scheduler/scheduler.proto
@@ -155,6 +155,16 @@ message Event {
// 'executor_id' will be set and possibly 'status' (if we were
// able to determine the exit status).
optional ExecutorID executor_id = 2;
+
+ // On Posix, `status` corresponds to termination information in the
+ // `stat_loc` area returned from a `waitpid` call. On Windows, `status`
+ // is obtained via calling the `GetExitCodeProcess()` function. For
+ // messages coming from Posix agents, schedulers need to apply
+ // `WEXITSTATUS` family macros or equivalent transformations to obtain
+ // exit codes.
+ //
+ // TODO(alexr): Consider unifying Windows and Posix behavior by returning
+ // exit code here, see MESOS-7241.
optional int32 status = 3;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/4f009180/include/mesos/v1/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto
index 8a733d9..115f1b4 100644
--- a/include/mesos/v1/mesos.proto
+++ b/include/mesos/v1/mesos.proto
@@ -1735,7 +1735,9 @@ enum TaskState {
*/
message CheckStatusInfo {
message Command {
- // Exit code of a command check.
+ // Exit code of a command check. It is the result of calling
+ // `WEXITSTATUS()` on `waitpid()` termination information on
+ // Posix and calling `GetExitCodeProcess()` on Windows.
optional int32 exit_code = 1;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/4f009180/include/mesos/v1/scheduler/scheduler.proto
----------------------------------------------------------------------
diff --git a/include/mesos/v1/scheduler/scheduler.proto b/include/mesos/v1/scheduler/scheduler.proto
index 2155864..00a54ec 100644
--- a/include/mesos/v1/scheduler/scheduler.proto
+++ b/include/mesos/v1/scheduler/scheduler.proto
@@ -155,6 +155,16 @@ message Event {
// 'executor_id' will be set and possibly 'status' (if we were
// able to determine the exit status).
optional ExecutorID executor_id = 2;
+
+ // On Posix, `status` corresponds to termination information in the
+ // `stat_loc` area returned from a `waitpid` call. On Windows, `status`
+ // is obtained via calling the `GetExitCodeProcess()` function. For
+ // messages coming from Posix agents, schedulers need to apply
+ // `WEXITSTATUS` family macros or equivalent transformations to obtain
+ // exit codes.
+ //
+ // TODO(alexr): Consider unifying Windows and Posix behavior by returning
+ // exit code here, see MESOS-7241.
optional int32 status = 3;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/4f009180/src/checks/checker.cpp
----------------------------------------------------------------------
diff --git a/src/checks/checker.cpp b/src/checks/checker.cpp
index 94315d7..5aae957 100644
--- a/src/checks/checker.cpp
+++ b/src/checks/checker.cpp
@@ -433,6 +433,12 @@ void CheckerProcess::processCommandCheckResult(
CheckStatusInfo checkStatusInfo;
checkStatusInfo.set_type(check.type());
+ // On Posix, `result` corresponds to termination information in the
+ // `stat_loc` area. On Windows, `status` is obtained via calling the
+ // `GetExitCodeProcess()` function.
+ //
+ // TODO(alexr): Ensure `WEXITSTATUS` family macros are no-op on Windows,
+ // see MESOS-7242.
if (result.isReady() && WIFEXITED(result.get())) {
const int exitCode = WEXITSTATUS(result.get());
VLOG(1) << check.type() << " check for task "