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"
@ -112,6 +113,10 @@ func (s *FirstFitWattsOnly) ResourceOffers(driver sched.SchedulerDriver, offers
log.Printf("Received %d resource offers", len(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{}{}
}
select {
case <-s.Shutdown:
log.Println("Done scheduling tasks: declining offer on [", offer.GetHostname(), "]")