Retrofitted all the schedulers to now call the offerutils.AddHostIfNew(..) utility function which will dynamically populate the constants.Hosts and constants.PowerClasses.

This commit is contained in:
Abhishek Jain 2017-03-24 16:28:49 -04:00
parent 841c7d5ee8
commit b4f9a989cb
16 changed files with 37 additions and 75 deletions

View file

@ -210,10 +210,7 @@ func (s *BinPackedPistonCapper) ResourceOffers(driver sched.SchedulerDriver, off
// retrieving the total power for each host in the offers
for _, offer := range offers {
if _, ok := constants.Hosts[offer.GetHostname()]; !ok {
log.Printf("New host found. Adding host [%s]", offer.GetHostname())
constants.Hosts[offer.GetHostname()] = struct{}{}
}
offerUtils.AddHostIfNew(offer)
if _, ok := s.totalPower[*offer.Hostname]; !ok {
_, _, offerWatts := offerUtils.OfferAgg(offer)
s.totalPower[*offer.Hostname] = offerWatts