Repository: mesos Updated Branches: refs/heads/master ab73d0cea -> e859d3ae8
Removed frameworks with suppressed offers from DRFSorter. This patch removes frameworks with suppressed offers from the sorter to reduce time spent in sorting. The allocations will remain in the sorter, so no data is lost and the numbers are still correct. When a framework revives offers, it will be re-added to the sorter. Review: https://reviews.apache.org/r/43666/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e859d3ae Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e859d3ae Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e859d3ae Branch: refs/heads/master Commit: e859d3ae8d8ff7349327b9e6a89edd6f98d2b7a1 Parents: ab73d0c Author: Dario Rexin <dario.re...@me.com> Authored: Thu Aug 4 17:12:10 2016 -0400 Committer: Joris Van Remoortere <joris.van.remoort...@gmail.com> Committed: Thu Aug 4 17:56:07 2016 -0400 ---------------------------------------------------------------------- src/master/allocator/mesos/hierarchical.cpp | 35 ++++++++++++++++-------- 1 file changed, 23 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/e859d3ae/src/master/allocator/mesos/hierarchical.cpp ---------------------------------------------------------------------- diff --git a/src/master/allocator/mesos/hierarchical.cpp b/src/master/allocator/mesos/hierarchical.cpp index 7d40645..234ef98 100644 --- a/src/master/allocator/mesos/hierarchical.cpp +++ b/src/master/allocator/mesos/hierarchical.cpp @@ -999,6 +999,14 @@ void HierarchicalAllocatorProcess::suppressOffers( frameworks[frameworkId].suppressed = true; + const string& role = frameworks[frameworkId].role; + + CHECK(frameworkSorters.contains(role)); + // Deactivating the framework in the sorter is fine as long as + // SUPPRESS is not parameterized. When parameterization is added, + // we have to differentiate between the cases here. + frameworkSorters[role]->deactivate(frameworkId.value()); + LOG(INFO) << "Suppressed offers for framework " << frameworkId; } @@ -1010,7 +1018,19 @@ void HierarchicalAllocatorProcess::reviveOffers( frameworks[frameworkId].offerFilters.clear(); frameworks[frameworkId].inverseOfferFilters.clear(); - frameworks[frameworkId].suppressed = false; + + if (frameworks[frameworkId].suppressed) { + frameworks[frameworkId].suppressed = false; + + const string& role = frameworks[frameworkId].role; + + CHECK(frameworkSorters.contains(role)); + + // Activating the framework in the sorter on REVIVE is fine as long as + // SUPPRESS is not parameterized. When parameterization is added, + // we may need to differentiate between the cases here. + frameworkSorters[role]->activate(frameworkId.value()); + } // We delete each actual `OfferFilter` when // `HierarchicalAllocatorProcess::expire` gets invoked. If we delete the @@ -1286,16 +1306,11 @@ void HierarchicalAllocatorProcess::allocate( } // Fetch frameworks according to their fair share. + // NOTE: Suppressed frameworks are not included in the sort. foreach (const string& frameworkId_, frameworkSorters[role]->sort()) { FrameworkID frameworkId; frameworkId.set_value(frameworkId_); - // If the framework has suppressed offers, ignore. The unallocated - // part of the quota will not be allocated to other roles. - if (frameworks[frameworkId].suppressed) { - continue; - } - // Only offer resources from slaves that have GPUs to // frameworks that are capable of receiving GPUs. // See MESOS-5634. @@ -1425,16 +1440,12 @@ void HierarchicalAllocatorProcess::allocate( } foreach (const string& role, roleSorter->sort()) { + // NOTE: Suppressed frameworks are not included in the sort. foreach (const string& frameworkId_, frameworkSorters[role]->sort()) { FrameworkID frameworkId; frameworkId.set_value(frameworkId_); - // If the framework has suppressed offers, ignore. - if (frameworks[frameworkId].suppressed) { - continue; - } - // Only offer resources from slaves that have GPUs to // frameworks that are capable of receiving GPUs. // See MESOS-5634.