This is an automated email from the ASF dual-hosted git repository. bmahler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 790c4e72e1460035b13bf27f2cb8999709e9767e Author: Benjamin Mahler <[email protected]> AuthorDate: Wed Aug 21 20:11:31 2019 -0400 Avoid duplicate allocatableTo call in the allocator. Review: https://reviews.apache.org/r/71346 --- src/master/allocator/mesos/hierarchical.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/master/allocator/mesos/hierarchical.cpp b/src/master/allocator/mesos/hierarchical.cpp index af9efd9..649de3b 100644 --- a/src/master/allocator/mesos/hierarchical.cpp +++ b/src/master/allocator/mesos/hierarchical.cpp @@ -1970,13 +1970,13 @@ void HierarchicalAllocatorProcess::__allocate() Sorter* frameworkSorter = CHECK_NOTNONE(getFrameworkSorter(role)); foreach (const string& frameworkId_, frameworkSorter->sort()) { - Resources available = slave.getAvailable(); + Resources available = slave.getAvailable().allocatableTo(role); // Offer a shared resource only if it has not been offered in this // offer cycle to a framework. available -= offeredSharedResources.get(slaveId).getOrElse(Resources()); - if (available.allocatableTo(role).empty()) { + if (available.empty()) { break; // Nothing left for the role. } @@ -2196,13 +2196,13 @@ void HierarchicalAllocatorProcess::__allocate() Sorter* frameworkSorter = CHECK_NOTNONE(getFrameworkSorter(role)); foreach (const string& frameworkId_, frameworkSorter->sort()) { - Resources available = slave.getAvailable(); + Resources available = slave.getAvailable().allocatableTo(role); // Offer a shared resource only if it has not been offered in this // offer cycle to a framework. available -= offeredSharedResources.get(slaveId).getOrElse(Resources()); - if (available.allocatableTo(role).empty()) { + if (available.empty()) { break; // Nothing left for the role. } @@ -2224,7 +2224,7 @@ void HierarchicalAllocatorProcess::__allocate() // First, reservations are always allocated. This also includes the // roles ancestors' reservations. - Resources toAllocate = available.allocatableTo(role).reserved(); + Resources toAllocate = available.reserved(); // Second, unreserved scalar resources are subject to quota limits // and global headroom enforcement.
