This is an automated email from the ASF dual-hosted git repository.

mzhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit f30c68b73544a6799aa134117d2f931170a377ec
Author: Meng Zhu <[email protected]>
AuthorDate: Thu Mar 21 17:24:55 2019 -0700

    Removed a lambda to simplify `__allocate()`.
    
    Review: https://reviews.apache.org/r/70266
---
 src/master/allocator/mesos/hierarchical.cpp | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/src/master/allocator/mesos/hierarchical.cpp 
b/src/master/allocator/mesos/hierarchical.cpp
index c9cf704..8bc7499 100644
--- a/src/master/allocator/mesos/hierarchical.cpp
+++ b/src/master/allocator/mesos/hierarchical.cpp
@@ -1632,20 +1632,6 @@ void HierarchicalAllocatorProcess::__allocate()
   // TODO(vinod): Implement a smarter sorting algorithm.
   std::random_shuffle(slaveIds.begin(), slaveIds.end());
 
-  // Returns the __quantity__ of resources allocated to a role with
-  // non-default quota. Since we account for reservations and persistent
-  // volumes toward quota, we strip reservation and persistent volumes
-  // related information for comparability. The result is used to
-  // determine whether a role's quota guarantee is satisfied, and
-  // also to determine how many resources the role would need in
-  // order to meet its quota guarantee.
-  //
-  // NOTE: Revocable resources are excluded in `quotaRoleSorter`.
-  auto getQuotaRoleAllocatedScalarQuantities = [this](const string& role) {
-    CHECK(quotas.contains(role));
-    return quotaRoleSorter->allocationScalarQuantities(role);
-  };
-
   // Returns the result of shrinking the provided resources down to the
   // target scalar quantities. If a resource does not have a target
   // quantity provided, it will not be shrunk.
@@ -1722,9 +1708,11 @@ void HierarchicalAllocatorProcess::__allocate()
     rolesConsumedQuotaScalarQuantites[role] +=
       reservationScalarQuantities.get(role).getOrElse(Resources());
 
-    // Then add allocated resoruces.
+    // Then add allocated resource _quantities_ .
+    // NOTE: Revocable resources are excluded in `quotaRoleSorter`.
+    CHECK(quotas.contains(role));
     rolesConsumedQuotaScalarQuantites[role] +=
-      getQuotaRoleAllocatedScalarQuantities(role);
+      quotaRoleSorter->allocationScalarQuantities(role);
 
     // Lastly subtract allocated reservations on each agent.
     foreachvalue (

Reply via email to