Retrofitted all the schedulers to call UpdateEnvironment(..) function instead of the old named function i.e AddHostIfNew(..)
This commit is contained in:
parent
8eddad4e17
commit
e01c7b1b1d
15 changed files with 24 additions and 24 deletions
|
@ -127,7 +127,7 @@ func (s *BinPackSortedWattsSortedOffers) ResourceOffers(driver sched.SchedulerDr
|
|||
log.Println("Sorted Offers:")
|
||||
for i := 0; i < len(offers); i++ {
|
||||
offer := offers[i]
|
||||
offerUtils.AddHostIfNew(offer)
|
||||
offerUtils.UpdateEnvironment(offer)
|
||||
offerCPU, _, _ := offerUtils.OfferAgg(offer)
|
||||
log.Printf("Offer[%s].CPU = %f\n", offer.GetHostname(), offerCPU)
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ func (s *BinPackedPistonCapper) ResourceOffers(driver sched.SchedulerDriver, off
|
|||
|
||||
// retrieving the total power for each host in the offers
|
||||
for _, offer := range offers {
|
||||
offerUtils.AddHostIfNew(offer)
|
||||
offerUtils.UpdateEnvironment(offer)
|
||||
if _, ok := s.totalPower[*offer.Hostname]; !ok {
|
||||
_, _, offerWatts := offerUtils.OfferAgg(offer)
|
||||
s.totalPower[*offer.Hostname] = offerWatts
|
||||
|
|
|
@ -120,7 +120,7 @@ func (s *BinPackSortedWatts) ResourceOffers(driver sched.SchedulerDriver, offers
|
|||
log.Printf("Received %d resource offers", len(offers))
|
||||
|
||||
for _, offer := range offers {
|
||||
offerUtils.AddHostIfNew(offer)
|
||||
offerUtils.UpdateEnvironment(offer)
|
||||
select {
|
||||
case <-s.Shutdown:
|
||||
log.Println("Done scheduling tasks: declining offer on [", offer.GetHostname(), "]")
|
||||
|
|
|
@ -18,12 +18,12 @@ import (
|
|||
)
|
||||
|
||||
/*
|
||||
Tasks are categorized into small and large tasks based on the watts requirement.
|
||||
All the small tasks are packed into offers from agents belonging to power class C and power class D, using BinPacking.
|
||||
All the large tasks are spread among the offers from agents belonging to power class A and power class B, using FirstFit.
|
||||
Tasks are categorized into small and large tasks based on watts requirements.
|
||||
All the large tasks are packed into offers from agents belonging to power classes A and B, using Bin-Packing.
|
||||
All the small tasks are spread among offers from agents belonging to power class C and D, using First-Fit.
|
||||
|
||||
BinPacking has the most effect when co-scheduling of tasks is increased. Large tasks typically utilize more resources and hence,
|
||||
co-scheduling them has a great impact on the total power utilization.
|
||||
Bin-Packing has the most effect when co-scheduling of tasks is increased. Large tasks typically utilize more resources and hence,
|
||||
co-scheduling them has a great impact on the total power utilization.
|
||||
*/
|
||||
|
||||
func (s *BottomHeavy) takeOfferBinPack(offer *mesos.Offer, totalCPU, totalRAM, totalWatts,
|
||||
|
@ -159,7 +159,7 @@ func (s *BottomHeavy) createTaskInfoAndLogSchedTrace(offer *mesos.Offer, task de
|
|||
return taskToSchedule
|
||||
}
|
||||
|
||||
// Using BinPacking to pack small tasks into this offer.
|
||||
// Using BinPacking to pack large tasks into the given offers.
|
||||
func (s *BottomHeavy) pack(offers []*mesos.Offer, driver sched.SchedulerDriver) {
|
||||
for _, offer := range offers {
|
||||
select {
|
||||
|
@ -221,7 +221,7 @@ func (s *BottomHeavy) pack(offers []*mesos.Offer, driver sched.SchedulerDriver)
|
|||
}
|
||||
}
|
||||
|
||||
// Using first fit to spread large tasks into these offers.
|
||||
// Using First-Fit to spread small tasks among the given offers.
|
||||
func (s *BottomHeavy) spread(offers []*mesos.Offer, driver sched.SchedulerDriver) {
|
||||
for _, offer := range offers {
|
||||
select {
|
||||
|
@ -282,7 +282,7 @@ func (s *BottomHeavy) ResourceOffers(driver sched.SchedulerDriver, offers []*mes
|
|||
offersLightPowerClasses := []*mesos.Offer{}
|
||||
|
||||
for _, offer := range offers {
|
||||
offerUtils.AddHostIfNew(offer)
|
||||
offerUtils.UpdateEnvironment(offer)
|
||||
select {
|
||||
case <-s.Shutdown:
|
||||
log.Println("Done scheduling tasks: declining offer on [", offer.GetHostname(), "]")
|
||||
|
|
|
@ -164,7 +164,7 @@ func (s *BPSWMaxMinWatts) ResourceOffers(driver sched.SchedulerDriver, offers []
|
|||
log.Printf("Received %d resource offers", len(offers))
|
||||
|
||||
for _, offer := range offers {
|
||||
offerUtils.AddHostIfNew(offer)
|
||||
offerUtils.UpdateEnvironment(offer)
|
||||
select {
|
||||
case <-s.Shutdown:
|
||||
log.Println("Done scheduling tasks: declining offer on [", offer.GetHostname(), "]")
|
||||
|
|
|
@ -261,7 +261,7 @@ func (s *BPSWMaxMinPistonCapping) ResourceOffers(driver sched.SchedulerDriver, o
|
|||
log.Printf("Received %d resource offers", len(offers))
|
||||
|
||||
for _, offer := range offers {
|
||||
offerUtils.AddHostIfNew(offer)
|
||||
offerUtils.UpdateEnvironment(offer)
|
||||
select {
|
||||
case <-s.Shutdown:
|
||||
log.Println("Done scheduling tasks: declining offer on [", offer.GetHostname(), "]")
|
||||
|
|
|
@ -300,7 +300,7 @@ func (s *BPSWMaxMinProacCC) ResourceOffers(driver sched.SchedulerDriver, offers
|
|||
|
||||
// retrieving the available power for all the hosts in the offers.
|
||||
for _, offer := range offers {
|
||||
offerUtils.AddHostIfNew(offer)
|
||||
offerUtils.UpdateEnvironment(offer)
|
||||
_, _, offerWatts := offerUtils.OfferAgg(offer)
|
||||
s.availablePower[*offer.Hostname] = offerWatts
|
||||
// setting total power if the first time
|
||||
|
|
|
@ -119,7 +119,7 @@ func (s *FirstFit) ResourceOffers(driver sched.SchedulerDriver, offers []*mesos.
|
|||
log.Printf("Received %d resource offers", len(offers))
|
||||
|
||||
for _, offer := range offers {
|
||||
offerUtils.AddHostIfNew(offer)
|
||||
offerUtils.UpdateEnvironment(offer)
|
||||
select {
|
||||
case <-s.Shutdown:
|
||||
log.Println("Done scheduling tasks: declining offer on [", offer.GetHostname(), "]")
|
||||
|
|
|
@ -233,7 +233,7 @@ func (s *FirstFitProacCC) ResourceOffers(driver sched.SchedulerDriver, offers []
|
|||
|
||||
// retrieving the available power for all the hosts in the offers.
|
||||
for _, offer := range offers {
|
||||
offerUtils.AddHostIfNew(offer)
|
||||
offerUtils.UpdateEnvironment(offer)
|
||||
_, _, offer_watts := offerUtils.OfferAgg(offer)
|
||||
s.availablePower[*offer.Hostname] = offer_watts
|
||||
// setting total power if the first time.
|
||||
|
|
|
@ -126,7 +126,7 @@ func (s *FirstFitSortedOffers) ResourceOffers(driver sched.SchedulerDriver, offe
|
|||
log.Println("Sorted Offers:")
|
||||
for i := 0; i < len(offers); i++ {
|
||||
offer := offers[i]
|
||||
offerUtils.AddHostIfNew(offer)
|
||||
offerUtils.UpdateEnvironment(offer)
|
||||
offerCPU, _, _ := offerUtils.OfferAgg(offer)
|
||||
log.Printf("Offer[%s].CPU = %f\n", offer.GetHostname(), offerCPU)
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ func (s *FirstFitSortedWattsProacCC) ResourceOffers(driver sched.SchedulerDriver
|
|||
|
||||
// retrieving the available power for all the hosts in the offers.
|
||||
for _, offer := range offers {
|
||||
offerUtils.AddHostIfNew(offer)
|
||||
offerUtils.UpdateEnvironment(offer)
|
||||
_, _, offer_watts := offerUtils.OfferAgg(offer)
|
||||
s.availablePower[*offer.Hostname] = offer_watts
|
||||
// setting total power if the first time.
|
||||
|
|
|
@ -128,7 +128,7 @@ func (s *FirstFitSortedWattsSortedOffers) ResourceOffers(driver sched.SchedulerD
|
|||
log.Println("Sorted Offers:")
|
||||
for i := 0; i < len(offers); i++ {
|
||||
offer := offers[i]
|
||||
offerUtils.AddHostIfNew(offer)
|
||||
offerUtils.UpdateEnvironment(offer)
|
||||
offerCPU, _, _ := offerUtils.OfferAgg(offer)
|
||||
log.Printf("Offer[%s].CPU = %f\n", offer.GetHostname(), offerCPU)
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ func (s *FirstFitSortedWatts) ResourceOffers(driver sched.SchedulerDriver, offer
|
|||
log.Printf("Received %d resource offers", len(offers))
|
||||
|
||||
for _, offer := range offers {
|
||||
offerUtils.AddHostIfNew(offer)
|
||||
offerUtils.UpdateEnvironment(offer)
|
||||
select {
|
||||
case <-s.Shutdown:
|
||||
log.Println("Done scheduling tasks: declining offer on [", offer.GetHostname(), "]")
|
||||
|
|
|
@ -112,7 +112,7 @@ func (s *FirstFitWattsOnly) ResourceOffers(driver sched.SchedulerDriver, offers
|
|||
log.Printf("Received %d resource offers", len(offers))
|
||||
|
||||
for _, offer := range offers {
|
||||
offerUtils.AddHostIfNew(offer)
|
||||
offerUtils.UpdateEnvironment(offer)
|
||||
select {
|
||||
case <-s.Shutdown:
|
||||
log.Println("Done scheduling tasks: declining offer on [", offer.GetHostname(), "]")
|
||||
|
|
|
@ -19,8 +19,8 @@ import (
|
|||
|
||||
/*
|
||||
Tasks are categorized into small and large tasks based on the watts requirement.
|
||||
All the large tasks are packed into offers from agents belonging to power class A and power class B, using BinPacking.
|
||||
All the small tasks are spread among the offers from agents belonging to power class C and power class D, using FirstFit.
|
||||
All the small tasks are packed into offers from agents belonging to power class C and power class D, using BinPacking.
|
||||
All the large tasks are spread among the offers from agents belonging to power class A and power class B, using FirstFit.
|
||||
|
||||
This was done to give a little more room for the large tasks (power intensive) for execution and reduce the possibility of
|
||||
starvation of power intensive tasks.
|
||||
|
@ -281,7 +281,7 @@ func (s *TopHeavy) ResourceOffers(driver sched.SchedulerDriver, offers []*mesos.
|
|||
offersLightPowerClasses := []*mesos.Offer{}
|
||||
|
||||
for _, offer := range offers {
|
||||
offerUtils.AddHostIfNew(offer)
|
||||
offerUtils.UpdateEnvironment(offer)
|
||||
select {
|
||||
case <-s.Shutdown:
|
||||
log.Println("Done scheduling tasks: declining offer on [", offer.GetHostname(), "]")
|
||||
|
|
Reference in a new issue