MCPcopy Create free account
hub / github.com/apache/mesos / removeSlave

Method removeSlave

src/master/allocator/mesos/hierarchical.cpp:1068–1109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1066
1067
1068void HierarchicalAllocatorProcess::removeSlave(
1069 const SlaveID& slaveId)
1070{
1071 CHECK(initialized);
1072
1073 {
1074 const Slave& slave = *CHECK_NOTNONE(getSlave(slaveId));
1075
1076 // untrackAllocatedResources() potentially removes allocation roles, thus
1077 // we need to untrack actually allocated resources in the roles tree first.
1078 roleTree.untrackAllocated(slaveId, slave.totalAllocated);
1079
1080 // Untrack resources in roleTree and sorter.
1081 foreachpair (
1082 const FrameworkID& frameworkId,
1083 const Resources& resources,
1084 slave.getOfferedOrAllocated()) {
1085 untrackAllocatedResources(slaveId, frameworkId, resources);
1086 }
1087
1088 roleSorter->removeSlave(slaveId);
1089
1090 foreachvalue (const Owned<Sorter>& sorter, frameworkSorters) {
1091 sorter->removeSlave(slaveId);
1092 }
1093
1094 roleTree.untrackReservations(slave.getTotal().reserved());
1095
1096 const ResourceQuantities agentScalarQuantities =
1097 ResourceQuantities::fromScalarResources(slave.getTotal().scalars());
1098
1099 CHECK_CONTAINS(totalScalarQuantities, agentScalarQuantities);
1100 totalScalarQuantities -= agentScalarQuantities;
1101 }
1102
1103 slaves.erase(slaveId);
1104 allocationCandidates.erase(slaveId);
1105
1106 removeFilters(slaveId);
1107
1108 LOG(INFO) << "Removed agent " << slaveId;
1109}
1110
1111
1112void HierarchicalAllocatorProcess::updateSlave(

Callers 2

foreachvalueFunction · 0.45
updateSlaveTotalMethod · 0.45

Calls 6

getSlaveFunction · 0.85
untrackAllocatedMethod · 0.80
untrackReservationsMethod · 0.80
reservedMethod · 0.45
scalarsMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected