Retrofitted all schedulers to now pick the hostname from the offer and add it to constants.Hosts

This commit is contained in:
Abhishek Jain 2017-03-23 22:16:05 -04:00
parent f85ed944f4
commit aed4fd1073
14 changed files with 70 additions and 6 deletions

View file

@ -1,6 +1,7 @@
package schedulers
import (
"bitbucket.org/sunybingcloud/electron/constants"
"bitbucket.org/sunybingcloud/electron/def"
"bitbucket.org/sunybingcloud/electron/utilities/mesosUtils"
"bitbucket.org/sunybingcloud/electron/utilities/offerUtils"
@ -128,6 +129,10 @@ func (s *FirstFitSortedWattsSortedOffers) ResourceOffers(driver sched.SchedulerD
log.Println("Sorted Offers:")
for i := 0; i < len(offers); i++ {
offer := offers[i]
if _, ok := constants.Hosts[offer.GetHostname()]; !ok {
log.Printf("New host found. Adding host [%s]", offer.GetHostname())
constants.Hosts[offer.GetHostname()] = struct{}{}
}
offerCPU, _, _ := offerUtils.OfferAgg(offer)
log.Printf("Offer[%s].CPU = %f\n", offer.GetHostname(), offerCPU)
}