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/12/07 20:36:47 UTC

mesos git commit: Used agent environment variables for I/O switchboard.

Repository: mesos
Updated Branches:
  refs/heads/master 91485138e -> 57d986c62


Used agent environment variables for I/O switchboard.

THe I/O switchboard server process will inheirt most of the agent
environment variables, except for those that are prefixed with MESOS
or LIBPROCESS since we don't rely on those environment variables.

The patch also manually set a few LIBPROCESS environment variables to
make sure the libprocess for the I/O switchboard can be initailzied
properly without depending on external environment.

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


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

Branch: refs/heads/master
Commit: 57d986c6251ba06c48cbaba4c0504e5cd3aa5be1
Parents: 9148513
Author: Jie Yu <yu...@gmail.com>
Authored: Wed Dec 7 10:10:06 2016 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Dec 7 12:26:20 2016 -0800

----------------------------------------------------------------------
 .../containerizer/mesos/io/switchboard.cpp      | 25 +++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/57d986c6/src/slave/containerizer/mesos/io/switchboard.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/io/switchboard.cpp b/src/slave/containerizer/mesos/io/switchboard.cpp
index 4452d5a..34ef5f9 100644
--- a/src/slave/containerizer/mesos/io/switchboard.cpp
+++ b/src/slave/containerizer/mesos/io/switchboard.cpp
@@ -537,6 +537,29 @@ Future<Option<ContainerLaunchInfo>> IOSwitchboard::_prepare(
                    " " + mkdir.error());
   }
 
+  // Prepare the environment for the io switchboard server process.
+  // We inherit agent environment variables except for those
+  // LIBPROCESS or MESOS prefixed environment variables since io
+  // switchboard server process does not rely on those environment
+  // variables.
+  map<string, string> environment;
+  foreachpair (const string& key, const string& value, os::environment()) {
+    if (!strings::startsWith(key, "LIBPROCESS_") &&
+        !strings::startsWith(key, "MESOS_")) {
+      environment.emplace(key, value);
+    }
+  }
+
+  // TODO(jieyu): This is to make sure the libprocess of the io
+  // switchboard can properly initialize and find the IP. Since we
+  // don't need to use the TCP socket for communication, it's OK to
+  // use a local address. Consider disable TCP socket in libprocess if
+  // libprocess supports that.
+  environment.emplace("LIBPROCESS_IP", "127.0.0.1");
+
+  // TODO(jieyu): Consider making this configurable.
+  environment.emplace("LIBPROCESS_NUM_WORKER_THREADS", "8");
+
   // Launch the io switchboard server process.
   // We `dup()` the `stdout` and `stderr` passed to us by the
   // container logger over the `stdout` and `stderr` of the io
@@ -550,7 +573,7 @@ Future<Option<ContainerLaunchInfo>> IOSwitchboard::_prepare(
       loggerInfo.out,
       loggerInfo.err,
       &switchboardFlags,
-      map<string, string>(),
+      environment,
       None(),
       {},
       {Subprocess::ChildHook::SETSID(),