You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ya...@apache.org on 2017/11/18 00:59:24 UTC
mesos git commit: Do not generate UnavailableResources for inactive
frameworks.
Repository: mesos
Updated Branches:
refs/heads/master 94ef10c2d -> 2939c86a5
Do not generate UnavailableResources for inactive frameworks.
Review: https://reviews.apache.org/r/63175
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2939c86a
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2939c86a
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2939c86a
Branch: refs/heads/master
Commit: 2939c86a5c99aadcd422f9f5c4b566a0465ec52c
Parents: 94ef10c
Author: Jiang Yan Xu <xu...@apple.com>
Authored: Sun Oct 15 23:47:54 2017 -0700
Committer: Jiang Yan Xu <xu...@apple.com>
Committed: Fri Nov 17 16:45:00 2017 -0800
----------------------------------------------------------------------
src/master/allocator/mesos/hierarchical.cpp | 31 +++++++++++++++++++-----
src/master/allocator/mesos/hierarchical.hpp | 7 ++++--
2 files changed, 30 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/2939c86a/src/master/allocator/mesos/hierarchical.cpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/mesos/hierarchical.cpp b/src/master/allocator/mesos/hierarchical.cpp
index f0f1111..cfeeb3b 100644
--- a/src/master/allocator/mesos/hierarchical.cpp
+++ b/src/master/allocator/mesos/hierarchical.cpp
@@ -133,10 +133,12 @@ private:
HierarchicalAllocatorProcess::Framework::Framework(
const FrameworkInfo& frameworkInfo,
- const set<string>& _suppressedRoles)
+ const set<string>& _suppressedRoles,
+ bool _active)
: roles(protobuf::framework::getRoles(frameworkInfo)),
suppressedRoles(_suppressedRoles),
- capabilities(frameworkInfo.capabilities()) {}
+ capabilities(frameworkInfo.capabilities()),
+ active(_active) {}
void HierarchicalAllocatorProcess::initialize(
@@ -259,7 +261,8 @@ void HierarchicalAllocatorProcess::addFramework(
CHECK(initialized);
CHECK(!frameworks.contains(frameworkId));
- frameworks.insert({frameworkId, Framework(frameworkInfo, suppressedRoles)});
+ frameworks.insert(
+ {frameworkId, Framework(frameworkInfo, suppressedRoles, active)});
const Framework& framework = frameworks.at(frameworkId);
@@ -314,7 +317,7 @@ void HierarchicalAllocatorProcess::removeFramework(
const FrameworkID& frameworkId)
{
CHECK(initialized);
- CHECK(frameworks.contains(frameworkId));
+ CHECK(frameworks.contains(frameworkId)) << frameworkId;
const Framework& framework = frameworks.at(frameworkId);
@@ -362,7 +365,9 @@ void HierarchicalAllocatorProcess::activateFramework(
CHECK(initialized);
CHECK(frameworks.contains(frameworkId));
- const Framework& framework = frameworks.at(frameworkId);
+ Framework& framework = frameworks.at(frameworkId);
+
+ framework.active = true;
// Activate all roles for this framework except the roles that
// are marked as deactivated.
@@ -387,7 +392,7 @@ void HierarchicalAllocatorProcess::deactivateFramework(
const FrameworkID& frameworkId)
{
CHECK(initialized);
- CHECK(frameworks.contains(frameworkId));
+ CHECK(frameworks.contains(frameworkId)) << frameworkId;
Framework& framework = frameworks.at(frameworkId);
@@ -402,6 +407,8 @@ void HierarchicalAllocatorProcess::deactivateFramework(
// the added/removed and activated/deactivated in the future.
}
+ framework.active = false;
+
// Do not delete the filters contained in this
// framework's `offerFilters` hashset yet, see comments in
// HierarchicalAllocatorProcess::reviveOffers and
@@ -1576,6 +1583,8 @@ void HierarchicalAllocatorProcess::__allocate()
CHECK(frameworks.contains(frameworkId));
const Framework& framework = frameworks.at(frameworkId);
+ CHECK(framework.active) << frameworkId;
+
Slave& slave = slaves.at(slaveId);
// Only offer resources from slaves that have GPUs to
@@ -1955,6 +1964,16 @@ void HierarchicalAllocatorProcess::deallocate()
FrameworkID frameworkId;
frameworkId.set_value(frameworkId_);
+ CHECK(frameworks.contains(frameworkId)) << frameworkId;
+
+ const Framework& framework = frameworks.at(frameworkId);
+
+ // No need to deallocate for an inactive framework as the master
+ // will not send it inverse offers.
+ if (!framework.active) {
+ continue;
+ }
+
// If this framework doesn't already have inverse offers for the
// specified slave.
if (!offerable[frameworkId].contains(slaveId)) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/2939c86a/src/master/allocator/mesos/hierarchical.hpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/mesos/hierarchical.hpp b/src/master/allocator/mesos/hierarchical.hpp
index 2f7755a..2c4832b 100644
--- a/src/master/allocator/mesos/hierarchical.hpp
+++ b/src/master/allocator/mesos/hierarchical.hpp
@@ -299,9 +299,10 @@ protected:
struct Framework
{
- explicit Framework(
+ Framework(
const FrameworkInfo& frameworkInfo,
- const std::set<std::string>& _suppressedRoles);
+ const std::set<std::string>& suppressedRoles,
+ bool active);
std::set<std::string> roles;
@@ -314,6 +315,8 @@ protected:
// were allocated to.
hashmap<std::string, hashmap<SlaveID, hashset<OfferFilter*>>> offerFilters;
hashmap<SlaveID, hashset<InverseOfferFilter*>> inverseOfferFilters;
+
+ bool active;
};
double _event_queue_dispatches()