You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2017/03/07 01:26:09 UTC
[3/7] mesos git commit: Renamed `activeRoles` to `roles` in the
master.
Renamed `activeRoles` to `roles` in the master.
The notion of "active" currently refers to an entity's state in regards
to the flow of resources. For example, a framework is said to be
"active" if it is receiving resources, and an agent is said to be
"active" if it is sending resources. `activeRoles` however does not
follow this notion of "active", since it simply consists of roles with
at least one __registered__ framework, rather than __active__.
Instead, it is a list of roles that the master is keeping track of.
We therefore opt to drop the "active" portion of this list of roles.
Review: https://reviews.apache.org/r/57329
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b97225c4
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b97225c4
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b97225c4
Branch: refs/heads/master
Commit: b97225c429bf10b91ba7a42c88b1a2b2864eef2f
Parents: 3e2f782
Author: Michael Park <mp...@apache.org>
Authored: Mon Mar 6 03:28:28 2017 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Mon Mar 6 15:07:23 2017 -0800
----------------------------------------------------------------------
src/master/http.cpp | 10 +++++-----
src/master/master.cpp | 20 ++++++++++----------
src/master/master.hpp | 2 +-
src/master/quota_handler.cpp | 4 ++--
src/master/weights_handler.cpp | 2 +-
5 files changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/b97225c4/src/master/http.cpp
----------------------------------------------------------------------
diff --git a/src/master/http.cpp b/src/master/http.cpp
index 58503ce..e81c4c3 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -3411,7 +3411,7 @@ Future<vector<string>> Master::Http::_roles(
const hashset<string>& whitelist = master->roleWhitelist.get();
roleList.insert(whitelist.begin(), whitelist.end());
} else {
- hashset<string> roles = master->activeRoles.keys();
+ hashset<string> roles = master->roles.keys();
roleList.insert(roles.begin(), roles.end());
hashset<string> weights = master->weights.keys();
@@ -3469,8 +3469,8 @@ Future<Response> Master::Http::roles(
}
Option<Role*> role = None();
- if (master->activeRoles.contains(name)) {
- role = master->activeRoles[name];
+ if (master->roles.contains(name)) {
+ role = master->roles[name];
}
array.values.push_back(model(name, weight, role));
@@ -3562,8 +3562,8 @@ Future<Response> Master::Http::getRoles(
role.set_weight(1.0);
}
- if (master->activeRoles.contains(name)) {
- Role* role_ = master->activeRoles[name];
+ if (master->roles.contains(name)) {
+ Role* role_ = master->roles[name];
role.mutable_resources()->CopyFrom(role_->resources());
http://git-wip-us.apache.org/repos/asf/mesos/blob/b97225c4/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 3fa5438..d6d954e 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -1196,10 +1196,10 @@ void Master::finalize()
future.discard();
}
- foreachvalue (Role* role, activeRoles) {
+ foreachvalue (Role* role, roles) {
delete role;
}
- activeRoles.clear();
+ roles.clear();
// NOTE: This is necessary during tests because we don't want the
// timer to fire in a different test and invoke the callback.
@@ -7463,10 +7463,10 @@ void Master::addFramework(Framework* framework)
<< "Unknown role '" << role << "'"
<< " of framework " << *framework;
- if (!activeRoles.contains(role)) {
- activeRoles[role] = new Role(role);
+ if (!roles.contains(role)) {
+ roles[role] = new Role(role);
}
- activeRoles.at(role)->addFramework(framework);
+ roles.at(role)->addFramework(framework);
};
if (framework->capabilities.multiRole) {
@@ -7902,12 +7902,12 @@ void Master::removeFramework(Framework* framework)
<< "Unknown role '" << role << "'"
<< " of framework " << *framework;
- CHECK(activeRoles.contains(role));
+ CHECK(roles.contains(role));
- activeRoles[role]->removeFramework(framework);
- if (activeRoles[role]->frameworks.empty()) {
- delete activeRoles[role];
- activeRoles.erase(role);
+ roles[role]->removeFramework(framework);
+ if (roles[role]->frameworks.empty()) {
+ delete roles[role];
+ roles.erase(role);
}
};
http://git-wip-us.apache.org/repos/asf/mesos/blob/b97225c4/src/master/master.hpp
----------------------------------------------------------------------
diff --git a/src/master/master.hpp b/src/master/master.hpp
index 47c5e61..0b3ff63 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -1821,7 +1821,7 @@ private:
hashmap<OfferID, process::Timer> inverseOfferTimers;
// Roles with > 0 frameworks currently registered.
- hashmap<std::string, Role*> activeRoles;
+ hashmap<std::string, Role*> roles;
// Configured role whitelist if using the (deprecated) "explicit
// roles" feature. If this is `None`, any role is allowed.
http://git-wip-us.apache.org/repos/asf/mesos/blob/b97225c4/src/master/quota_handler.cpp
----------------------------------------------------------------------
diff --git a/src/master/quota_handler.cpp b/src/master/quota_handler.cpp
index 5212ed7..11cca90 100644
--- a/src/master/quota_handler.cpp
+++ b/src/master/quota_handler.cpp
@@ -135,8 +135,8 @@ void Master::QuotaHandler::rescindOffers(const QuotaInfo& request) const
CHECK(master->isWhitelistedRole(role));
int frameworksInRole = 0;
- if (master->activeRoles.contains(role)) {
- Role* roleState = master->activeRoles[role];
+ if (master->roles.contains(role)) {
+ Role* roleState = master->roles[role];
foreachvalue (const Framework* framework, roleState->frameworks) {
if (framework->active()) {
++frameworksInRole;
http://git-wip-us.apache.org/repos/asf/mesos/blob/b97225c4/src/master/weights_handler.cpp
----------------------------------------------------------------------
diff --git a/src/master/weights_handler.cpp b/src/master/weights_handler.cpp
index 453bf37..a4d2fed 100644
--- a/src/master/weights_handler.cpp
+++ b/src/master/weights_handler.cpp
@@ -294,7 +294,7 @@ void Master::WeightsHandler::rescindOffers(
// Rescind all outstanding offers if at least one of the
// updated roles has a registered frameworks.
- if (master->activeRoles.contains(role)) {
+ if (master->roles.contains(role)) {
rescind = true;
break;
}