Repository: mesos
Updated Branches:
  refs/heads/master 81d4b20d7 -> a981067d2


Added ContainerID to container logger prepare interface.

This is to allow the logger to tag the output with that information.

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


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

Branch: refs/heads/master
Commit: a981067d2dd4a1ce6be68d3fd5a7115ce47b3a24
Parents: 81d4b20
Author: Jie Yu <yujie....@gmail.com>
Authored: Thu May 17 15:27:26 2018 -0700
Committer: Jie Yu <yujie....@gmail.com>
Committed: Thu May 17 16:48:20 2018 -0700

----------------------------------------------------------------------
 CHANGELOG                                        | 2 +-
 docs/upgrades.md                                 | 2 +-
 include/mesos/slave/container_logger.hpp         | 2 ++
 src/slave/container_loggers/lib_logrotate.cpp    | 6 +++++-
 src/slave/container_loggers/lib_logrotate.hpp    | 1 +
 src/slave/container_loggers/sandbox.cpp          | 6 +++++-
 src/slave/container_loggers/sandbox.hpp          | 1 +
 src/slave/containerizer/docker.cpp               | 4 ++--
 src/slave/containerizer/mesos/io/switchboard.cpp | 2 +-
 9 files changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/a981067d/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index cddc055..349d9a0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,7 +4,7 @@ This release contains the following new features:
 
 Additional API Changes:
   * Container logger module interface has been changed. The `prepare()` method
-    now takes `ContainerConfig` instead.
+    now takes `ContainerID` and `ContainerConfig` instead.
 
 
 Release Notes - Mesos - Version 1.6.1 (WIP)

http://git-wip-us.apache.org/repos/asf/mesos/blob/a981067d/docs/upgrades.md
----------------------------------------------------------------------
diff --git a/docs/upgrades.md b/docs/upgrades.md
index 5813ed7..fb6b865 100644
--- a/docs/upgrades.md
+++ b/docs/upgrades.md
@@ -432,7 +432,7 @@ We categorize the changes as follows:
 
 <a name="1-7-x-container-logger"></a>
 
-* `ContainerLogger` module interface has been changed. The `prepare()` method 
now takes `ContainerConfig` instead.
+* `ContainerLogger` module interface has been changed. The `prepare()` method 
now takes `ContainerID` and `ContainerConfig` instead.
 
 ## Upgrading from 1.5.x to 1.6.x ##
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/a981067d/include/mesos/slave/container_logger.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/slave/container_logger.hpp 
b/include/mesos/slave/container_logger.hpp
index 5fe2369..4e6d15a 100644
--- a/include/mesos/slave/container_logger.hpp
+++ b/include/mesos/slave/container_logger.hpp
@@ -89,6 +89,7 @@ public:
    * be capable of recovering managed containers during the agent recovery
    * process. See `ContainerLogger::recover`.
    *
+   * @param containerId The ID of the container.
    * @param containerConfig The configurations of the container, including the
    *     ExecutorInfo (if applied), as well as the absolute path to the sandbox
    *     directory of the container. The sandbox path is provided in case
@@ -97,6 +98,7 @@ public:
    *     the sandbox are exposed via the `/files` endpoint.
    */
   virtual process::Future<ContainerIO> prepare(
+      const ContainerID& containerId,
       const ContainerConfig& containerConfig) = 0;
 };
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/a981067d/src/slave/container_loggers/lib_logrotate.cpp
----------------------------------------------------------------------
diff --git a/src/slave/container_loggers/lib_logrotate.cpp 
b/src/slave/container_loggers/lib_logrotate.cpp
index f0a59d0..fa71e07 100644
--- a/src/slave/container_loggers/lib_logrotate.cpp
+++ b/src/slave/container_loggers/lib_logrotate.cpp
@@ -75,7 +75,9 @@ public:
   // Spawns two subprocesses that read from their stdin and write to
   // "stdout" and "stderr" files in the sandbox.  The subprocesses will rotate
   // the files according to the configured maximum size and number of files.
-  Future<ContainerIO> prepare(const ContainerConfig& containerConfig)
+  Future<ContainerIO> prepare(
+      const ContainerID& containerId,
+      const ContainerConfig& containerConfig)
   {
     // Prepare the environment for the container logger subprocess.
     // We inherit agent environment variables except for those
@@ -290,11 +292,13 @@ Try<Nothing> LogrotateContainerLogger::initialize()
 
 
 Future<ContainerIO> LogrotateContainerLogger::prepare(
+    const ContainerID& containerId,
     const ContainerConfig& containerConfig)
 {
   return dispatch(
       process.get(),
       &LogrotateContainerLoggerProcess::prepare,
+      containerId,
       containerConfig);
 }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/a981067d/src/slave/container_loggers/lib_logrotate.hpp
----------------------------------------------------------------------
diff --git a/src/slave/container_loggers/lib_logrotate.hpp 
b/src/slave/container_loggers/lib_logrotate.hpp
index 303511c..d0abaa4 100644
--- a/src/slave/container_loggers/lib_logrotate.hpp
+++ b/src/slave/container_loggers/lib_logrotate.hpp
@@ -198,6 +198,7 @@ public:
   virtual Try<Nothing> initialize() override;
 
   virtual process::Future<mesos::slave::ContainerIO> prepare(
+      const ContainerID& containerId,
       const mesos::slave::ContainerConfig& containerConfig) override;
 
 protected:

http://git-wip-us.apache.org/repos/asf/mesos/blob/a981067d/src/slave/container_loggers/sandbox.cpp
----------------------------------------------------------------------
diff --git a/src/slave/container_loggers/sandbox.cpp 
b/src/slave/container_loggers/sandbox.cpp
index ce4faec..21c61a3 100644
--- a/src/slave/container_loggers/sandbox.cpp
+++ b/src/slave/container_loggers/sandbox.cpp
@@ -62,7 +62,9 @@ public:
   SandboxContainerLoggerProcess()
     : ProcessBase(process::ID::generate("sandbox-logger")) {}
 
-  Future<ContainerIO> prepare(const ContainerConfig& containerConfig)
+  Future<ContainerIO> prepare(
+      const ContainerID& containerId,
+      const ContainerConfig& containerConfig)
   {
     ContainerIO io;
 
@@ -98,11 +100,13 @@ Try<Nothing> SandboxContainerLogger::initialize()
 
 
 Future<ContainerIO> SandboxContainerLogger::prepare(
+    const ContainerID& containerId,
     const ContainerConfig& containerConfig)
 {
   return dispatch(
       process.get(),
       &SandboxContainerLoggerProcess::prepare,
+      containerId,
       containerConfig);
 }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/a981067d/src/slave/container_loggers/sandbox.hpp
----------------------------------------------------------------------
diff --git a/src/slave/container_loggers/sandbox.hpp 
b/src/slave/container_loggers/sandbox.hpp
index 39e0eeb..784b118 100644
--- a/src/slave/container_loggers/sandbox.hpp
+++ b/src/slave/container_loggers/sandbox.hpp
@@ -61,6 +61,7 @@ public:
   // stderr to separate "stdout" and "stderr" files in the sandbox.
   // The `path`, `argv`, and `environment` are not changed.
   virtual process::Future<mesos::slave::ContainerIO> prepare(
+      const ContainerID& containerId,
       const mesos::slave::ContainerConfig& containerConfig) override;
 
 protected:

http://git-wip-us.apache.org/repos/asf/mesos/blob/a981067d/src/slave/containerizer/docker.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.cpp 
b/src/slave/containerizer/docker.cpp
index 725cdb5..fc03236 100644
--- a/src/slave/containerizer/docker.cpp
+++ b/src/slave/containerizer/docker.cpp
@@ -1383,7 +1383,7 @@ Future<Docker::Container> 
DockerContainerizerProcess::launchExecutorContainer(
   Container* container = containers_.at(containerId);
   container->state = Container::RUNNING;
 
-  return logger->prepare(container->containerConfig)
+  return logger->prepare(container->id, container->containerConfig)
     .then(defer(
         self(),
         [=](const ContainerIO& containerIO)
@@ -1543,7 +1543,7 @@ Future<pid_t> 
DockerContainerizerProcess::launchExecutorProcess(
 
   return allocateGpus
     .then(defer(self(), [=]() {
-      return logger->prepare(container->containerConfig);
+      return logger->prepare(container->id, container->containerConfig);
     }))
     .then(defer(
         self(),

http://git-wip-us.apache.org/repos/asf/mesos/blob/a981067d/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 d0f98ad..6d99fb5 100644
--- a/src/slave/containerizer/mesos/io/switchboard.cpp
+++ b/src/slave/containerizer/mesos/io/switchboard.cpp
@@ -287,7 +287,7 @@ Future<Option<ContainerLaunchInfo>> IOSwitchboard::prepare(
   // launched, the nested containers launched later might not have
   // access to the root parent container's ExecutorInfo (i.e.,
   // 'containerConfig.executor_info()' will be empty).
-  return logger->prepare(containerConfig)
+  return logger->prepare(containerId, containerConfig)
     .then(defer(
         PID<IOSwitchboard>(this),
         &IOSwitchboard::_prepare,

Reply via email to