You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2016/10/12 21:42:31 UTC

[1/3] mesos git commit: Windows: Implemented os::execvpe with _spawnvpe.

Repository: mesos
Updated Branches:
  refs/heads/master 44cc1932c -> 1e514ca02


Windows: Implemented os::execvpe with _spawnvpe.

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


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

Branch: refs/heads/master
Commit: 8c8ec608503394575a4f99fd725010b8920e5efa
Parents: 44cc193
Author: Joseph Wu <jo...@apache.org>
Authored: Wed Oct 12 11:57:18 2016 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Wed Oct 12 14:41:29 2016 -0700

----------------------------------------------------------------------
 3rdparty/stout/include/stout/os/windows/shell.hpp | 14 ++++++++++++++
 3rdparty/stout/include/stout/windows/os.hpp       |  6 ------
 2 files changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/8c8ec608/3rdparty/stout/include/stout/os/windows/shell.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/windows/shell.hpp b/3rdparty/stout/include/stout/os/windows/shell.hpp
index 0ababb4..17e3d56 100644
--- a/3rdparty/stout/include/stout/os/windows/shell.hpp
+++ b/3rdparty/stout/include/stout/os/windows/shell.hpp
@@ -149,6 +149,20 @@ inline int execvp(const char* file, char* const argv[])
 }
 
 
+// On Windows, the `_spawnvpe` call creates a new process.
+// In order to emulate the semantics of `execvpe`, we spawn with `_P_WAIT`,
+// which forces the parent process to block on the child. When the child exits,
+// the exit code is propagated back through the parent via `exit()`.
+//
+// The returned value from `_spawnvpe` represents child exit code when
+// `_P_WAIT` is used.
+inline int execvpe(const char* file, char* const argv[], char* const envp[])
+{
+  exit(static_cast<int>(::_spawnvpe(_P_WAIT, file, argv, envp)));
+  return 0;
+}
+
+
 // Concatenates multiple command-line arguments and escapes the values.
 // If `arg` is not specified (or takes the value `0`), the function will
 // scan `argv` until a `nullptr` is encountered.

http://git-wip-us.apache.org/repos/asf/mesos/blob/8c8ec608/3rdparty/stout/include/stout/windows/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/windows/os.hpp b/3rdparty/stout/include/stout/windows/os.hpp
index 7d6530e..7ca0b5d 100644
--- a/3rdparty/stout/include/stout/windows/os.hpp
+++ b/3rdparty/stout/include/stout/windows/os.hpp
@@ -374,12 +374,6 @@ inline std::string hstrerror(int err)
 }
 
 
-// This function is a portable version of execvpe ('p' means searching
-// executable from PATH and 'e' means setting environments). We add
-// this function because it is not available on all systems.
-inline int execvpe(const char* file, char** argv, char** envp) = delete;
-
-
 inline Try<Nothing> chown(
     uid_t uid,
     gid_t gid,


[2/3] mesos git commit: Updated CLI bootstrap to search for local virtualenv installations.

Posted by jo...@apache.org.
Updated CLI bootstrap to search for local virtualenv installations.

A locally installed virtualenv does not always show up on the `PATH`,
which fails `which virtualenv`.  This adds an extra search location
based on the user's site package install directory.

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


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

Branch: refs/heads/master
Commit: 9588a6009e956ec1629be13df6a41dc98dd0180d
Parents: 8c8ec60
Author: Joseph Wu <jo...@mesosphere.io>
Authored: Wed Oct 12 13:17:56 2016 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Wed Oct 12 14:41:30 2016 -0700

----------------------------------------------------------------------
 src/cli_new/bootstrap | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/9588a600/src/cli_new/bootstrap
----------------------------------------------------------------------
diff --git a/src/cli_new/bootstrap b/src/cli_new/bootstrap
index 74a8568..6d62e9a 100755
--- a/src/cli_new/bootstrap
+++ b/src/cli_new/bootstrap
@@ -29,11 +29,22 @@ if [ "${OLD_VIRTUAL_ENV}" != "" ]; then
 fi
 
 # Verify that python and virtualenv are installed.
-if [ "${PYTHON}" = "" ] || [ "${VIRTUALENV}" = "" ]; then
-  echo "You must have python and virtualenv installed in order to continue..."
+if [ "${PYTHON}" = "" ]; then
+  echo "You must have python installed in order to continue..."
   exit 1
 fi
 
+if [ "${VIRTUALENV}" = "" ]; then
+  # Search for a locally installed virtualenv.
+  # See https://docs.python.org/2/library/site.html#site.USER_SITE for details.
+  VIRTUALENV=$(${PYTHON} -c "import site; print site.USER_SITE")/virtualenv.py
+
+  if [ ! -f "${VIRTUALENV}" ]; then
+    echo "You must have virtualenv installed in order to continue..."
+    exit 1
+  fi
+fi
+
 PYTHON_MAJOR=$(${PYTHON} -c 'import sys; print(sys.version_info[0])')
 PYTHON_MINOR=$(${PYTHON} -c 'import sys; print(sys.version_info[1])')
 


[3/3] mesos git commit: Supported `ContainerLogger` with nested containers.

Posted by jo...@apache.org.
Supported `ContainerLogger` with nested containers.

For nested containers, the sandbox directory still exists.  However,
ExecutorInfo's no longer map directly one-to-one to containers.
That means a nested container does not have an associated ExecutorInfo.

The `ExecutorInfo` parameter provides metadata for the `ContainerLogger`
including the FrameworkID, ExecutorID, environment variables, and
arbitrary Labels.  For nested containers, the top-level parent's
`ExecutorInfo` should be sufficient to provide the same metadata.

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


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

Branch: refs/heads/master
Commit: 1e514ca023526f949e0ed5b91d43636a1b2fd172
Parents: 9588a60
Author: Gilbert Song <so...@gmail.com>
Authored: Wed Oct 12 14:38:43 2016 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Wed Oct 12 14:41:30 2016 -0700

----------------------------------------------------------------------
 src/slave/containerizer/mesos/containerizer.cpp | 21 +++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/1e514ca0/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index 7ec6f78..f5a4858 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -1333,8 +1333,27 @@ Future<bool> MesosContainerizerProcess::_launch(
     environment.values[name] = value;
   }
 
+  // Determine the 'ExecutorInfo' for the logger. If launching a
+  // top level executor container, use the 'ExecutorInfo' from
+  // 'ContainerConfig'. If launching a nested container, use the
+  // 'ExecutorInfo' from its top level parent container.
+  ExecutorInfo executorInfo;
+  if (container->config.has_executor_info()) {
+    // The top level executor container case. The 'ExecutorInfo'
+    // will always be set in 'ContainerConfig'.
+    executorInfo = container->config.executor_info();
+  } else {
+    // The nested container case. Use the 'ExecutorInfo' from its root
+    // parent container.
+    CHECK(containerId.has_parent());
+    const ContainerID& rootContainerId = getRootContainerId(containerId);
+    CHECK(containers_.contains(rootContainerId));
+    CHECK(containers_[rootContainerId]->config.has_executor_info());
+    executorInfo = containers_[rootContainerId]->config.executor_info();
+  }
+
   return logger->prepare(
-      container->config.executor_info(),
+      executorInfo,
       container->config.directory())
     .then(defer(
         self(),