mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ji...@apache.org
Subject [7/7] mesos git commit: Changed 'ExecutorInfo' to be optional in ContainerState.
Date Tue, 27 Sep 2016 01:30:08 GMT
Changed 'ExecutorInfo' to be optional in ContainerState.

This is necessary for recovering nested containers, because a list of
'ContainerState' including recoverable top level containers and nested
containers will be passed to isolator::recover, but there is no way for
nested containers to carry the ExecutorInfo.

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


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

Branch: refs/heads/master
Commit: ad73e8c7d8a6f39b3fe4edb9c53a4aa1619c9d38
Parents: 837cbf7
Author: Gilbert Song <songzihao1990@gmail.com>
Authored: Mon Sep 26 17:32:37 2016 -0700
Committer: Jie Yu <yujie.jay@gmail.com>
Committed: Mon Sep 26 18:29:48 2016 -0700

----------------------------------------------------------------------
 include/mesos/slave/containerizer.proto | 12 ++++++++----
 src/common/protobuf_utils.cpp           |  9 +++++++--
 src/common/protobuf_utils.hpp           |  2 +-
 3 files changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ad73e8c7/include/mesos/slave/containerizer.proto
----------------------------------------------------------------------
diff --git a/include/mesos/slave/containerizer.proto b/include/mesos/slave/containerizer.proto
index 238dbb6..86d1859 100644
--- a/include/mesos/slave/containerizer.proto
+++ b/include/mesos/slave/containerizer.proto
@@ -52,13 +52,17 @@ message ContainerLimitation {
  * any dependency on RunState and in turn on internal protobufs.
  */
 message ContainerState {
-  required ExecutorInfo executor_info = 1;
+  // This field only exists for top level containers.
+  optional ExecutorInfo executor_info = 1;
 
-  // Container id of the last executor run.
+  // The container Id.
   required ContainerID container_id = 2;
 
-  required uint64 pid = 3;            // Executor pid.
-  required string directory = 4;      // Executor work directory.
+  // The pid of the init process in the container.
+  required uint64 pid = 3;
+
+  // The sandbox directory.
+  required string directory = 4;
 }
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/ad73e8c7/src/common/protobuf_utils.cpp
----------------------------------------------------------------------
diff --git a/src/common/protobuf_utils.cpp b/src/common/protobuf_utils.cpp
index 3ff37f4..1f08868 100644
--- a/src/common/protobuf_utils.cpp
+++ b/src/common/protobuf_utils.cpp
@@ -379,16 +379,21 @@ ContainerLimitation createContainerLimitation(
 
 
 ContainerState createContainerState(
-    const ExecutorInfo& executorInfo,
+    const Option<ExecutorInfo>& executorInfo,
     const ContainerID& container_id,
     pid_t pid,
     const string& directory)
 {
   ContainerState state;
-  state.mutable_executor_info()->CopyFrom(executorInfo);
+
+  if (executorInfo.isSome()) {
+    state.mutable_executor_info()->CopyFrom(executorInfo.get());
+  }
+
   state.mutable_container_id()->CopyFrom(container_id);
   state.set_pid(pid);
   state.set_directory(directory);
+
   return state;
 }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/ad73e8c7/src/common/protobuf_utils.hpp
----------------------------------------------------------------------
diff --git a/src/common/protobuf_utils.hpp b/src/common/protobuf_utils.hpp
index c5e5a9a..0c6405f 100644
--- a/src/common/protobuf_utils.hpp
+++ b/src/common/protobuf_utils.hpp
@@ -121,7 +121,7 @@ mesos::slave::ContainerLimitation createContainerLimitation(
 
 
 mesos::slave::ContainerState createContainerState(
-    const ExecutorInfo& executorInfo,
+    const Option<ExecutorInfo>& executorInfo,
     const ContainerID& id,
     pid_t pid,
     const std::string& directory);


Mime
View raw message