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/02/10 18:12:13 UTC

[2/8] mesos git commit: Extended life of process based docker executor on systemd.

Extended life of process based docker executor on systemd.

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


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

Branch: refs/heads/master
Commit: 435a147cabff20f96acebbce65b047afba22e102
Parents: cf607e8
Author: Joris Van Remoortere <jo...@gmail.com>
Authored: Fri Feb 5 14:00:01 2016 -0500
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Wed Feb 10 18:12:05 2016 +0100

----------------------------------------------------------------------
 src/slave/containerizer/docker.cpp | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/435a147c/src/slave/containerizer/docker.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.cpp b/src/slave/containerizer/docker.cpp
index 19daf7d..ed1c9a5 100644
--- a/src/slave/containerizer/docker.cpp
+++ b/src/slave/containerizer/docker.cpp
@@ -40,6 +40,7 @@
 
 #ifdef __linux__
 #include "linux/cgroups.hpp"
+#include "linux/systemd.hpp"
 #endif // __linux__
 
 #include "slave/paths.hpp"
@@ -954,6 +955,16 @@ Future<pid_t> DockerContainerizerProcess::launchExecutorProcess(
         self(),
         [=](const ContainerLogger::SubprocessInfo& subprocessInfo)
           -> Future<pid_t> {
+    // If we are on systemd, then extend the life of the executor. Any
+    // grandchildren's lives will also be extended.
+    std::vector<Subprocess::Hook> parentHooks;
+#ifdef __linux__
+    if (systemd::enabled()) {
+      parentHooks.emplace_back(Subprocess::Hook(
+          &systemd::mesos::extendLifetime));
+    }
+#endif // __linux__
+
     // Construct the mesos-docker-executor using the "name" we gave the
     // container (to distinguish it from Docker containers not created
     // by Mesos).
@@ -965,7 +976,9 @@ Future<pid_t> DockerContainerizerProcess::launchExecutorProcess(
         subprocessInfo.err,
         dockerFlags(flags, container->name(), container->directory),
         environment,
-        lambda::bind(&setup, container->directory));
+        lambda::bind(&setup, container->directory),
+        None(),
+        parentHooks);
 
     if (s.isError()) {
       return Failure("Failed to fork executor: " + s.error());