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:
parent
841c7d5ee8
commit
b4f9a989cb
16 changed files with 37 additions and 75 deletions
|
@ -1,7 +1,6 @@
|
|||
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"
|
||||
|
@ -129,10 +128,7 @@ 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{}{}
|
||||
}
|
||||
offerUtils.AddHostIfNew(offer)
|
||||
offerCPU, _, _ := offerUtils.OfferAgg(offer)
|
||||
log.Printf("Offer[%s].CPU = %f\n", offer.GetHostname(), offerCPU)
|
||||
}
|
||||
|
|
Reference in a new issue