You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2015/04/18 00:02:20 UTC
mesos git commit: Fix docker containerizer usage and test.
Repository: mesos
Updated Branches:
refs/heads/master a97ae7510 -> 757b6ea3e
Fix docker containerizer usage and test.
The docker usage test is failing with the most recent change in
including executor resources in docker containerizer.
Review: https://reviews.apache.org/r/33318
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/757b6ea3
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/757b6ea3
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/757b6ea3
Branch: refs/heads/master
Commit: 757b6ea3ea803396db9260658b05a4836fde985a
Parents: a97ae75
Author: Timothy Chen <tn...@apache.org>
Authored: Fri Apr 17 14:45:42 2015 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Fri Apr 17 15:02:12 2015 -0700
----------------------------------------------------------------------
src/slave/containerizer/docker.hpp | 16 +++++++++++++---
src/slave/slave.cpp | 4 ++--
src/tests/docker_containerizer_tests.cpp | 6 ++++--
3 files changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/757b6ea3/src/slave/containerizer/docker.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.hpp b/src/slave/containerizer/docker.hpp
index 6893684..1c81717 100644
--- a/src/slave/containerizer/docker.hpp
+++ b/src/slave/containerizer/docker.hpp
@@ -289,11 +289,21 @@ private:
symlinked(symlinked),
flags(flags)
{
+ // NOTE: The task's resources are included in the executor's
+ // resources in order to make sure when launching the executor
+ // that it has non-zero resources in the event the executor was
+ // not actually given any resources by the framework
+ // originally. See Framework::launchExecutor in slave.cpp. We
+ // check that this is indeed the case here to protect ourselves
+ // from when/if this changes in the future (but it's not a
+ // perfect check because an executor might always have more
+ // resources than a task, nevertheless, it's better than
+ // nothing).
if (task.isSome()) {
- resources = task.get().resources() + executor.resources();
- } else {
- resources = executor.resources();
+ CHECK(executor.resources() >= task.get().resources());
}
+
+ resources = executor.resources();
}
~Container()
http://git-wip-us.apache.org/repos/asf/mesos/blob/757b6ea3/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index a0595f9..8ec80ed 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -4245,7 +4245,7 @@ Executor* Framework::launchExecutor(
// when it has registered to the slave.
launch = slave->containerizer->launch(
containerId,
- executorInfo_, // modified to include the task's resources.
+ executorInfo_, // Modified to include the task's resources, see above.
executor->directory,
user,
slave->info.id(),
@@ -4263,7 +4263,7 @@ Executor* Framework::launchExecutor(
launch = slave->containerizer->launch(
containerId,
taskInfo,
- executorInfo_,
+ executorInfo_, // Modified to include the task's resources, see above.
executor->directory,
user,
slave->info.id(),
http://git-wip-us.apache.org/repos/asf/mesos/blob/757b6ea3/src/tests/docker_containerizer_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/docker_containerizer_tests.cpp b/src/tests/docker_containerizer_tests.cpp
index c772d4c..b119a17 100644
--- a/src/tests/docker_containerizer_tests.cpp
+++ b/src/tests/docker_containerizer_tests.cpp
@@ -970,8 +970,10 @@ TEST_F(DockerContainerizerTest, ROOT_DOCKER_Usage)
waited += Milliseconds(200);
} while (waited < Seconds(3));
- EXPECT_EQ(2, statistics.cpus_limit());
- EXPECT_EQ(Gigabytes(1).bytes(), statistics.mem_limit_bytes());
+ // Usage includes the executor resources.
+ EXPECT_EQ(2.0 + slave::DEFAULT_EXECUTOR_CPUS, statistics.cpus_limit());
+ EXPECT_EQ((Gigabytes(1) + slave::DEFAULT_EXECUTOR_MEM).bytes(),
+ statistics.mem_limit_bytes());
EXPECT_LT(0, statistics.cpus_user_time_secs());
EXPECT_LT(0, statistics.cpus_system_time_secs());