You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2016/08/15 17:16:43 UTC

mesos git commit: Consolidated two executorEnvironment() calls in docker containerizer.

Repository: mesos
Updated Branches:
  refs/heads/master 7657b5de2 -> 5f06d10b7


Consolidated two executorEnvironment() calls in docker containerizer.

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


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

Branch: refs/heads/master
Commit: 5f06d10b7b07bc80cd0ab77b37ce885ad9807257
Parents: 7657b5d
Author: Gilbert Song <so...@gmail.com>
Authored: Mon Aug 15 10:16:35 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Aug 15 10:16:35 2016 -0700

----------------------------------------------------------------------
 src/slave/containerizer/docker.cpp |  8 ++++----
 src/slave/containerizer/docker.hpp | 15 ++-------------
 2 files changed, 6 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/5f06d10b/src/slave/containerizer/docker.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.cpp b/src/slave/containerizer/docker.cpp
index 5c1ee8e..4c2def3 100644
--- a/src/slave/containerizer/docker.cpp
+++ b/src/slave/containerizer/docker.cpp
@@ -302,7 +302,6 @@ DockerContainerizerProcess::Container::create(
 
   Option<ContainerInfo> containerInfo = None();
   Option<CommandInfo> commandInfo = None();
-  Option<map<string, string>> environment = None();
   bool launchesExecutorContainer = false;
   if (taskInfo.isSome() && flags.docker_mesos_image.isSome()) {
     // Override the container and command to launch an executor
@@ -361,15 +360,16 @@ DockerContainerizerProcess::Container::create(
 
     containerInfo = newContainerInfo;
     commandInfo = newCommandInfo;
-    environment = executorEnvironment(
+    launchesExecutorContainer = true;
+  }
+
+  map<string, string> environment = executorEnvironment(
         executorInfo,
         containerWorkdir,
         slaveId,
         slavePid,
         checkpoint,
         flags);
-    launchesExecutorContainer = true;
-  }
 
   return new Container(
       id,

http://git-wip-us.apache.org/repos/asf/mesos/blob/5f06d10b/src/slave/containerizer/docker.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.hpp b/src/slave/containerizer/docker.hpp
index f2a0606..0ba4ed2 100644
--- a/src/slave/containerizer/docker.hpp
+++ b/src/slave/containerizer/docker.hpp
@@ -296,12 +296,13 @@ private:
               const Flags& flags,
               const Option<CommandInfo>& _command,
               const Option<ContainerInfo>& _container,
-              const Option<std::map<std::string, std::string>>& _environment,
+              const std::map<std::string, std::string>& _environment,
               bool launchesExecutorContainer)
       : state(FETCHING),
         id(id),
         task(taskInfo),
         executor(executorInfo),
+        environment(_environment),
         directory(directory),
         user(user),
         slaveId(slaveId),
@@ -342,18 +343,6 @@ private:
       } else {
         container = executor.container();
       }
-
-      if (_environment.isSome()) {
-        environment = _environment.get();
-      } else {
-        environment = executorEnvironment(
-            executor,
-            directory,
-            slaveId,
-            slavePid,
-            checkpoint,
-            flags);
-      }
     }
 
     ~Container()