Skip to content

Instantly share code, notes, and snippets.

@sagar8192
Created May 18, 2018 00:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sagar8192/0b9dbccc908818f8f9f5a18d1f634513 to your computer and use it in GitHub Desktop.
Save sagar8192/0b9dbccc908818f8f9f5a18d1f634513 to your computer and use it in GitHub Desktop.
diff --git a/src/master/master.cpp b/src/master/master.cpp
index cc2685a6b..e6548dd8f 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -8660,6 +8660,13 @@ void Master::offer(
resources.at(role)) {
Slave* slave = slaves.registered.get(slaveId);
+ // Do not send the offer from the slave, if it marked for
+ // maintenance.
+ CHECK(machines.contains(slave->machineId));
+ if (machines[slave->machineId].info.has_unavailability()) {
+ continue;
+ }
+
if (slave == nullptr) {
LOG(WARNING)
<< "Master returning resources offered to framework " << *framework
@@ -8739,14 +8746,6 @@ void Master::offer(
}
}
- // If the slave in this offer is planned to be unavailable due to
- // maintenance in the future, then set the Unavailability.
- CHECK(machines.contains(slave->machineId));
- if (machines[slave->machineId].info.has_unavailability()) {
- offer->mutable_unavailability()->CopyFrom(
- machines[slave->machineId].info.unavailability());
- }
-
offers[offer->id()] = offer;
framework->addOffer(offer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment