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.
This commit is contained in:
parent
0135ee69e4
commit
270b5a7ee1
1 changed files with 3 additions and 3 deletions
|
@ -66,7 +66,7 @@ func NewBPSWClassMapWatts(tasks []def.Task, ignoreWatts bool) *BPSWClassMapWatts
|
||||||
return s
|
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)
|
taskName := fmt.Sprintf("%s-%d", task.Name, *task.Instances)
|
||||||
s.tasksCreated++
|
s.tasksCreated++
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ func (s *BPSWClassMapWatts) newTask(offer *mesos.Offer, task def.Task) *mesos.Ta
|
||||||
}
|
}
|
||||||
|
|
||||||
if !s.ignoreWatts {
|
if !s.ignoreWatts {
|
||||||
resources = append(resources, mesosutil.NewScalarResource("watts", task.Watts))
|
resources = append(resources, mesosutil.NewScalarResource("watts", task.ClassToWatts[newTaskClass]))
|
||||||
}
|
}
|
||||||
|
|
||||||
return &mesos.TaskInfo{
|
return &mesos.TaskInfo{
|
||||||
|
@ -181,7 +181,7 @@ func (s *BPSWClassMapWatts) ResourceOffers(driver sched.SchedulerDriver, offers
|
||||||
totalRAM += task.RAM
|
totalRAM += task.RAM
|
||||||
log.Println("Co-Located with: ")
|
log.Println("Co-Located with: ")
|
||||||
coLocated(s.running[offer.GetSlaveId().GoString()])
|
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)
|
fmt.Println("Inst: ", *task.Instances)
|
||||||
*task.Instances--
|
*task.Instances--
|
||||||
|
|
Reference in a new issue