You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/04/25 23:36:13 UTC

[32/48] 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/60dc7ab3
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/60dc7ab3
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/60dc7ab3

Branch: refs/heads/0.27.x
Commit: 60dc7ab347d014d700daed7944f3823bb5cd6c1a
Parents: e83e63a
Author: Joris Van Remoortere <jo...@gmail.com>
Authored: Fri Feb 5 14:00:01 2016 -0500
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Tue Feb 16 18:21:10 2016 -0500

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


http://git-wip-us.apache.org/repos/asf/mesos/blob/60dc7ab3/src/slave/containerizer/docker.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.cpp b/src/slave/containerizer/docker.cpp
index 2887cb4..3849e96 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());