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

Method updateSlaveTotal

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

Source from the content-addressed store, hash-verified

3019
3020
3021bool HierarchicalAllocatorProcess::updateSlaveTotal(
3022 const SlaveID& slaveId,
3023 const Resources& total)
3024{
3025 Slave& slave = *CHECK_NOTNONE(getSlave(slaveId));
3026
3027 const Resources oldTotal = slave.getTotal();
3028
3029 if (oldTotal == total) {
3030 return false;
3031 }
3032
3033 slave.updateTotal(total);
3034
3035 roleTree.untrackReservations(oldTotal.reserved());
3036 roleTree.trackReservations(total.reserved());
3037
3038 // Update the total in the allocator and totals in the sorters.
3039 const ResourceQuantities oldAgentScalarQuantities =
3040 ResourceQuantities::fromScalarResources(oldTotal.scalars());
3041
3042 const ResourceQuantities agentScalarQuantities =
3043 ResourceQuantities::fromScalarResources(total.scalars());
3044
3045 CHECK_CONTAINS(totalScalarQuantities, oldAgentScalarQuantities);
3046 totalScalarQuantities -= oldAgentScalarQuantities;
3047 totalScalarQuantities += agentScalarQuantities;
3048
3049 roleSorter->removeSlave(slaveId);
3050 roleSorter->addSlave(slaveId, agentScalarQuantities);
3051
3052 foreachvalue (const Owned<Sorter>& sorter, frameworkSorters) {
3053 sorter->removeSlave(slaveId);
3054 sorter->addSlave(slaveId, agentScalarQuantities);
3055 }
3056
3057 return true;
3058}
3059
3060
3061bool HierarchicalAllocatorProcess::isRemoteSlave(const Slave& slave) const

Callers

nothing calls this directly

Calls 8

getSlaveFunction · 0.85
updateTotalMethod · 0.80
untrackReservationsMethod · 0.80
trackReservationsMethod · 0.80
reservedMethod · 0.45
scalarsMethod · 0.45
removeSlaveMethod · 0.45
addSlaveMethod · 0.45

Tested by

no test coverage detected