fixed aggregate check for BinPacking. This had been broken due to a previous merge.

This commit is contained in:
Pradyumna Kaushik 2017-02-27 18:37:53 -05:00
parent ccbe7a14b7
commit ef8a315e90
5 changed files with 24 additions and 15 deletions

View file

@ -21,7 +21,8 @@ import (
)
// Decides if to take an offer or not
func (s *BPSWMaxMinPistonCapping) takeOffer(offer *mesos.Offer, task def.Task) bool {
func (s *BPSWMaxMinPistonCapping) takeOffer(offer *mesos.Offer, task def.Task,
totalCPU, totalRAM, totalWatts float64) bool {
cpus, mem, watts := offerUtils.OfferAgg(offer)
@ -32,7 +33,8 @@ func (s *BPSWMaxMinPistonCapping) takeOffer(offer *mesos.Offer, task def.Task) b
// Error in determining wattsConsideration
log.Fatal(err)
}
if cpus >= task.CPU && mem >= task.RAM && (!s.wattsAsAResource || (watts >= wattsConsideration)) {
if (cpus >= (totalCPU + task.CPU)) && (mem >= (totalRAM + task.RAM)) &&
(!s.wattsAsAResource || (watts >= (totalWatts + wattsConsideration))) {
return true
}
return false
@ -218,7 +220,7 @@ func (s *BPSWMaxMinPistonCapping) CheckFit(
partialLoad *float64) (bool, *mesos.TaskInfo) {
// Does the task fit
if s.takeOffer(offer, task) {
if s.takeOffer(offer, task, *totalCPU, *totalRAM, *totalWatts) {
// Start piston capping if haven't started yet
if !s.isCapping {