You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by id...@apache.org on 2014/11/10 19:57:43 UTC

mesos git commit: Always recover 'completed' in RunState.

Repository: mesos
Updated Branches:
  refs/heads/master f8c89e8ed -> 0f7bac864


Always recover 'completed' in RunState.

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


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

Branch: refs/heads/master
Commit: 0f7bac8643a3a9949dad1d3557dbc4ee4d359367
Parents: f8c89e8
Author: Ian Downes <id...@twitter.com>
Authored: Fri Nov 7 11:22:52 2014 -0800
Committer: Ian Downes <id...@twitter.com>
Committed: Mon Nov 10 10:36:57 2014 -0800

----------------------------------------------------------------------
 src/slave/state.cpp | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/0f7bac86/src/slave/state.cpp
----------------------------------------------------------------------
diff --git a/src/slave/state.cpp b/src/slave/state.cpp
index 87e9eb9..48695da 100644
--- a/src/slave/state.cpp
+++ b/src/slave/state.cpp
@@ -384,6 +384,15 @@ Try<RunState> RunState::recover(
   state.id = containerId;
   string message;
 
+  // See if the sentinel file exists. This is done first so it is
+  // known even if partial state is returned, e.g., if the libprocess
+  // pid file is not recovered. It indicates the slave removed the
+  // executor.
+  string path = paths::getExecutorSentinelPath(
+      rootDir, slaveId, frameworkId, executorId, containerId);
+
+  state.completed = os::exists(path);
+
   // Find the tasks.
   Try<list<string> > tasks = os::glob(strings::format(
       paths::TASK_PATH,
@@ -418,7 +427,7 @@ Try<RunState> RunState::recover(
   }
 
   // Read the forked pid.
-  string path = paths::getForkedPidPath(
+  path = paths::getForkedPidPath(
       rootDir, slaveId, frameworkId, executorId, containerId);
   if (!os::exists(path)) {
     // This could happen if the slave died before the isolator
@@ -493,12 +502,6 @@ Try<RunState> RunState::recover(
 
   state.libprocessPid = process::UPID(pid.get());
 
-  // See if the sentinel file exists.
-  path = paths::getExecutorSentinelPath(
-      rootDir, slaveId, frameworkId, executorId, containerId);
-
-  state.completed = os::exists(path);
-
   return state;
 }