Repository: mesos Updated Branches: refs/heads/master 28eda7458 -> 380ec46f8
Implemented `CgroupsIsolatorProcess::status`. Review: https://reviews.apache.org/r/49825/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/380ec46f Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/380ec46f Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/380ec46f Branch: refs/heads/master Commit: 380ec46f86db56ba8467eb03028c9175061f98b0 Parents: 28eda74 Author: haosdent huang <haosd...@gmail.com> Authored: Wed Jul 27 16:29:45 2016 -0700 Committer: Jie Yu <yujie....@gmail.com> Committed: Wed Jul 27 16:32:57 2016 -0700 ---------------------------------------------------------------------- .../mesos/isolators/cgroups/cgroups.cpp | 26 +++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/380ec46f/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp ---------------------------------------------------------------------- diff --git a/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp b/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp index 5f59898..bd20631 100644 --- a/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp +++ b/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp @@ -315,7 +315,31 @@ Future<ResourceStatistics> CgroupsIsolatorProcess::usage( Future<ContainerStatus> CgroupsIsolatorProcess::status( const ContainerID& containerId) { - return Failure("Not implemented."); + if (!infos.contains(containerId)) { + return Failure("Unknown container"); + } + + list<Future<ContainerStatus>> statuses; + foreachvalue (const Owned<Subsystem>& subsystem, subsystems) { + statuses.push_back(subsystem->status(containerId)); + } + + return await(statuses) + .then([containerId](const list<Future<ContainerStatus>>& _statuses) { + ContainerStatus result; + + foreach (const Future<ContainerStatus>& status, _statuses) { + if (status.isReady()) { + result.MergeFrom(status.get()); + } else { + LOG(WARNING) << "Skipping status for container " << containerId + << " because: " + << (status.isFailed() ? status.failure() : "discarded"); + } + } + + return result; + }); }