From 270b5a7ee17f03dc576b23fee048b77d1ac8c511 Mon Sep 17 00:00:00 2001 From: Pradyumna Kaushik Date: Fri, 6 Jan 2017 15:41:13 -0800 Subject: [PATCH] Fixed bug. Now watts is taken from task.ClassMapWatts[nodeClass] and not task.Watts. Changed the function signature of newTask(...) to take in another parameter called newTaskClass that corresponds to the nodeClass. --- schedulers/bpswClassMapWatts.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/schedulers/bpswClassMapWatts.go b/schedulers/bpswClassMapWatts.go index 5307807..13bbdc7 100644 --- a/schedulers/bpswClassMapWatts.go +++ b/schedulers/bpswClassMapWatts.go @@ -66,7 +66,7 @@ func NewBPSWClassMapWatts(tasks []def.Task, ignoreWatts bool) *BPSWClassMapWatts return s } -func (s *BPSWClassMapWatts) newTask(offer *mesos.Offer, task def.Task) *mesos.TaskInfo { +func (s *BPSWClassMapWatts) newTask(offer *mesos.Offer, task def.Task, newTaskClass string) *mesos.TaskInfo { taskName := fmt.Sprintf("%s-%d", task.Name, *task.Instances) s.tasksCreated++ @@ -90,7 +90,7 @@ func (s *BPSWClassMapWatts) newTask(offer *mesos.Offer, task def.Task) *mesos.Ta } if !s.ignoreWatts { - resources = append(resources, mesosutil.NewScalarResource("watts", task.Watts)) + resources = append(resources, mesosutil.NewScalarResource("watts", task.ClassToWatts[newTaskClass])) } return &mesos.TaskInfo{ @@ -181,7 +181,7 @@ func (s *BPSWClassMapWatts) ResourceOffers(driver sched.SchedulerDriver, offers totalRAM += task.RAM log.Println("Co-Located with: ") coLocated(s.running[offer.GetSlaveId().GoString()]) - tasks = append(tasks, s.newTask(offer, task)) + tasks = append(tasks, s.newTask(offer, task, nodeClass)) fmt.Println("Inst: ", *task.Instances) *task.Instances--