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 2017/08/28 20:14:09 UTC

mesos git commit: Enabled `DockerContainerizerProcess::usage` for all platforms.

Repository: mesos
Updated Branches:
  refs/heads/master df61d25b4 -> 7ae79307e


Enabled `DockerContainerizerProcess::usage` for all platforms.

When originally implemented this code was enabled only for Linux.
However, this code should work anywhere Docker is being used, as it
obtains the information by shelling out to the `docker` executable.

This patch fixes the resources information provided by the `mesos-agent`
on Windows platforms for Docker containers by making the `statistics`
JSON object available.

Note that the `cgroupsStatistics` is Linux specific, and so the
pre-processor guard was not removed but reduced in scope for just it.

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


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

Branch: refs/heads/master
Commit: 7ae79307edf155e8e9d1739d303fd88fe9453ab1
Parents: df61d25
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Mon Aug 28 22:13:15 2017 +0200
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Mon Aug 28 22:13:15 2017 +0200

----------------------------------------------------------------------
 src/slave/containerizer/docker.cpp | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/7ae79307/src/slave/containerizer/docker.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.cpp b/src/slave/containerizer/docker.cpp
index cbcff39..6d688c8 100644
--- a/src/slave/containerizer/docker.cpp
+++ b/src/slave/containerizer/docker.cpp
@@ -1843,9 +1843,6 @@ Future<ResourceStatistics> DockerContainerizerProcess::usage(
 {
   CHECK(!containerId.has_parent());
 
-#ifndef __linux__
-  return Failure("Does not support usage() on non-linux platform");
-#else
   if (!containers_.contains(containerId)) {
     return Failure("Unknown container: " + stringify(containerId));
   }
@@ -1869,12 +1866,15 @@ Future<ResourceStatistics> DockerContainerizerProcess::usage(
       return Failure("Container is being removed: " + stringify(containerId));
     }
 
+    ResourceStatistics result;
+#ifdef __linux__
     const Try<ResourceStatistics> cgroupStats = cgroupsStatistics(pid);
     if (cgroupStats.isError()) {
       return Failure("Failed to collect cgroup stats: " + cgroupStats.error());
     }
 
-    ResourceStatistics result = cgroupStats.get();
+    result = cgroupStats.get();
+#endif // __linux__
 
     // Set the resource allocations.
     const Resources& resource = container->resources;
@@ -1919,7 +1919,6 @@ Future<ResourceStatistics> DockerContainerizerProcess::usage(
 
         return collectUsage(pid.get());
       }));
-#endif // __linux__
 }