You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2016/03/31 15:32:01 UTC
[4/6] mesos git commit: Deprecated the `docker_stop_timeout` flag.
Deprecated the `docker_stop_timeout` flag.
Instead, a combination of `executor_shutdown_grace_period`
agent flag and task kill policies should be used.
Review: https://reviews.apache.org/r/44661
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/1bbe4859
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/1bbe4859
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/1bbe4859
Branch: refs/heads/master
Commit: 1bbe485945035f9573cd2bf48d594d79b9a40392
Parents: 327f840
Author: Alexander Rukletsov <ru...@gmail.com>
Authored: Thu Mar 10 15:07:59 2016 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Thu Mar 31 14:35:45 2016 +0200
----------------------------------------------------------------------
CHANGELOG | 2 ++
docs/configuration.md | 5 +++--
src/docker/executor.hpp | 7 ++++++-
src/slave/containerizer/docker.cpp | 16 ++++++++++++++--
src/slave/flags.cpp | 6 ++++--
src/slave/flags.hpp | 3 +++
6 files changed, 32 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/1bbe4859/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 09b9e63..b90078d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -31,6 +31,8 @@ Deprecations:
* [MESOS-2281] - Deprecated the plain text format for credentials in favor of
the JSON format.
+ * [MESOS-4910] - Deprecate the --docker_stop_timeout agent flag.
+
* [MESOS-5001] - The 'allocator/event_queue_dispatches' metric is now
deprecated in favor 'of allocator/mesos/event_queue_dispatches'.
http://git-wip-us.apache.org/repos/asf/mesos/blob/1bbe4859/docs/configuration.md
----------------------------------------------------------------------
diff --git a/docs/configuration.md b/docs/configuration.md
index 75c9a0a..da42eaf 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -1124,8 +1124,9 @@ path used by the slave's docker image.
--docker_stop_timeout=VALUE
</td>
<td>
-The time as a duration for docker to wait after stopping an instance
-before it kills that instance. (default: 0ns)
+The time docker daemon waits after stopping a container before killing
+that container. This flag is deprecated; use task's kill policy instead.
+(default: 0ns)
</td>
</tr>
<tr>
http://git-wip-us.apache.org/repos/asf/mesos/blob/1bbe4859/src/docker/executor.hpp
----------------------------------------------------------------------
diff --git a/src/docker/executor.hpp b/src/docker/executor.hpp
index abbc419..798ca3d 100644
--- a/src/docker/executor.hpp
+++ b/src/docker/executor.hpp
@@ -52,10 +52,12 @@ struct Flags : public mesos::internal::logging::Flags
"mapped_directory",
"The sandbox directory path that is mapped in the docker container.\n");
+ // TODO(alexr): Remove this after the deprecation cycle (started in 0.29).
add(&stop_timeout,
"stop_timeout",
"The duration for docker to wait after stopping a running container\n"
- "before it kills that container.");
+ "before it kills that container. This flag is deprecated; use task's\n"
+ "kill policy instead.");
add(&launcher_dir,
"launcher_dir",
@@ -69,7 +71,10 @@ struct Flags : public mesos::internal::logging::Flags
Option<std::string> docker_socket;
Option<std::string> sandbox_directory;
Option<std::string> mapped_directory;
+
+ // TODO(alexr): Remove this after the deprecation cycle (started in 0.29).
Option<Duration> stop_timeout;
+
Option<std::string> launcher_dir;
};
http://git-wip-us.apache.org/repos/asf/mesos/blob/1bbe4859/src/slave/containerizer/docker.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.cpp b/src/slave/containerizer/docker.cpp
index c5007a3..9314d1f 100644
--- a/src/slave/containerizer/docker.cpp
+++ b/src/slave/containerizer/docker.cpp
@@ -209,9 +209,12 @@ docker::Flags dockerFlags(
dockerFlags.docker = flags.docker;
dockerFlags.sandbox_directory = directory;
dockerFlags.mapped_directory = flags.sandbox_directory;
- dockerFlags.stop_timeout = flags.docker_stop_timeout;
dockerFlags.docker_socket = flags.docker_socket;
dockerFlags.launcher_dir = flags.launcher_dir;
+
+ // TODO(alexr): Remove this after the deprecation cycle (started in 0.29).
+ dockerFlags.stop_timeout = flags.docker_stop_timeout;
+
return dockerFlags;
}
@@ -925,7 +928,11 @@ Future<Nothing> DockerContainerizerProcess::__recover(
// Check if we're watching an executor for this container ID and
// if not, rm -f the Docker container.
if (!containers_.contains(id.get())) {
- // TODO(tnachen): Consider using executor_shutdown_grace_period.
+ // TODO(alexr): After the deprecation cycle (started in 0.29.0), update
+ // this to omit the timeout. Graceful shutdown of the container is not
+ // a containerizer responsibility; it is the responsibility of the agent
+ // in co-operation with the executor. Once `destroy()` is called, the
+ // container should be destroyed forcefully.
futures.push_back(
docker->stop(
container.id,
@@ -1837,6 +1844,11 @@ void DockerContainerizerProcess::_destroy(
LOG(INFO) << "Running docker stop on container '" << containerId << "'";
if (killed) {
+ // TODO(alexr): After the deprecation cycle (started in 0.29.0), update
+ // this to omit the timeout. Graceful shutdown of the container is not
+ // a containerizer responsibility; it is the responsibility of the agent
+ // in co-operation with the executor. Once `destroy()` is called, the
+ // container should be destroyed forcefully.
docker->stop(container->name(), flags.docker_stop_timeout)
.onAny(defer(self(), &Self::__destroy, containerId, killed, lambda::_1));
} else {
http://git-wip-us.apache.org/repos/asf/mesos/blob/1bbe4859/src/slave/flags.cpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index 8868e1e..0551ec3 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -524,10 +524,12 @@ mesos::internal::slave::Flags::Flags()
" ]\n"
"}");
+ // TODO(alexr): Remove this after the deprecation cycle (started in 0.29).
add(&Flags::docker_stop_timeout,
"docker_stop_timeout",
- "The time as a duration for docker to wait after stopping an instance\n"
- "before it kills that instance.",
+ "The time docker daemon waits after stopping a container before\n"
+ "killing that container. This flag is deprecated; use task's kill\n"
+ "policy instead.",
Seconds(0));
#ifdef ENABLE_NVIDIA_GPU_SUPPORT
http://git-wip-us.apache.org/repos/asf/mesos/blob/1bbe4859/src/slave/flags.hpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.hpp b/src/slave/flags.hpp
index 345a225..d0c606e 100644
--- a/src/slave/flags.hpp
+++ b/src/slave/flags.hpp
@@ -107,7 +107,10 @@ public:
Duration docker_remove_delay;
std::string sandbox_directory;
Option<ContainerInfo> default_container_info;
+
+ // TODO(alexr): Remove this after the deprecation cycle (started in 0.29).
Duration docker_stop_timeout;
+
bool docker_kill_orphans;
std::string docker_socket;
#ifdef ENABLE_NVIDIA_GPU_SUPPORT