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:32:29 UTC
[36/50] 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/f7985e99
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f7985e99
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f7985e99
Branch: refs/heads/0.26.x
Commit: f7985e99457e5746c0d5084714a593a24345d176
Parents: 3a05580
Author: Joris Van Remoortere <jo...@gmail.com>
Authored: Fri Feb 5 14:00:01 2016 -0500
Committer: Michael Park <mp...@apache.org>
Committed: Fri Feb 26 20:59:06 2016 -0800
----------------------------------------------------------------------
src/slave/containerizer/docker.cpp | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/f7985e99/src/slave/containerizer/docker.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.cpp b/src/slave/containerizer/docker.cpp
index 5189041..f53035a 100644
--- a/src/slave/containerizer/docker.cpp
+++ b/src/slave/containerizer/docker.cpp
@@ -39,6 +39,7 @@
#ifdef __linux__
#include "linux/cgroups.hpp"
+#include "linux/systemd.hpp"
#endif // __linux__
#include "slave/paths.hpp"
@@ -903,6 +904,16 @@ Future<pid_t> DockerContainerizerProcess::launchExecutorProcess(
vector<string> argv;
argv.push_back("mesos-docker-executor");
+ // 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).
@@ -914,7 +925,9 @@ Future<pid_t> DockerContainerizerProcess::launchExecutorProcess(
Subprocess::PATH(path::join(container->directory, "stderr")),
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());