You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2017/01/30 01:18:43 UTC
[2/3] mesos git commit: Augmented printing of Resources to include
AllocationInfo.
Augmented printing of Resources to include AllocationInfo.
Ignoring whether there is a disk info, the format is as follows:
name(reservedrole[, principal[, labels]])(allocatedrole):value
Review: https://reviews.apache.org/r/55825
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/aa0ea8fc
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/aa0ea8fc
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/aa0ea8fc
Branch: refs/heads/master
Commit: aa0ea8fc8846f2914784d6ad229843adbbc8e400
Parents: 9aa1d61
Author: Benjamin Mahler <bm...@apache.org>
Authored: Fri Jan 20 18:31:45 2017 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Sun Jan 29 17:12:30 2017 -0800
----------------------------------------------------------------------
src/common/resources.cpp | 4 ++++
src/tests/resources_tests.cpp | 7 +++++++
src/v1/resources.cpp | 4 ++++
3 files changed, 15 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/aa0ea8fc/src/common/resources.cpp
----------------------------------------------------------------------
diff --git a/src/common/resources.cpp b/src/common/resources.cpp
index 54486cf..b3eae51 100644
--- a/src/common/resources.cpp
+++ b/src/common/resources.cpp
@@ -1944,6 +1944,10 @@ ostream& operator<<(ostream& stream, const Resource& resource)
stream << ")";
+ if (resource.has_allocation_info()) {
+ stream << "(allocated: " << resource.allocation_info().role() << ")";
+ }
+
if (resource.has_disk()) {
stream << "[" << resource.disk() << "]";
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/aa0ea8fc/src/tests/resources_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/resources_tests.cpp b/src/tests/resources_tests.cpp
index 0ed8f6b..e1ac164 100644
--- a/src/tests/resources_tests.cpp
+++ b/src/tests/resources_tests.cpp
@@ -814,6 +814,13 @@ TEST(ResourcesTest, PrintingExtendedAttributes)
stream << disk;
EXPECT_EQ("disk(alice):1", stream.str());
+ // Allocated resource.
+ stream.str("");
+ disk.mutable_allocation_info()->set_role("role");
+ stream << disk;
+ EXPECT_EQ("disk(alice)(allocated: role):1", stream.str());
+ disk.clear_allocation_info();
+
// Standard revocable resource.
stream.str("");
disk.mutable_revocable();
http://git-wip-us.apache.org/repos/asf/mesos/blob/aa0ea8fc/src/v1/resources.cpp
----------------------------------------------------------------------
diff --git a/src/v1/resources.cpp b/src/v1/resources.cpp
index 0e3e73a..5ba7b65 100644
--- a/src/v1/resources.cpp
+++ b/src/v1/resources.cpp
@@ -1933,6 +1933,10 @@ ostream& operator<<(ostream& stream, const Resource& resource)
stream << ")";
+ if (resource.has_allocation_info()) {
+ stream << "(allocated: " << resource.allocation_info().role() << ")";
+ }
+
if (resource.has_disk()) {
stream << "[" << resource.disk() << "]";
}