Checked for task fitting watts requirement considering watts to be a hard limit.
This commit is contained in:
parent
236be222cd
commit
a07806f570
1 changed files with 3 additions and 15 deletions
|
@ -196,15 +196,6 @@ func (s *PistonCapper) stopCapping() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether we are overloading the host (from watts perspective)
|
|
||||||
func wattsOverload(task def.Task, offerWatts float64, totalPower float64) bool {
|
|
||||||
if offerWatts >= (totalPower + (task.Watts * constants.CapMargin)) {
|
|
||||||
return false
|
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *PistonCapper) ResourceOffers(driver sched.SchedulerDriver, offers []*mesos.Offer) {
|
func (s *PistonCapper) ResourceOffers(driver sched.SchedulerDriver, offers []*mesos.Offer) {
|
||||||
log.Printf("Received %d resource offers", len(offers))
|
log.Printf("Received %d resource offers", len(offers))
|
||||||
|
|
||||||
|
@ -228,9 +219,6 @@ func (s *PistonCapper) ResourceOffers(driver sched.SchedulerDriver, offers []*me
|
||||||
For each set of tasks that are scheduled, compute the new cap values for each host in the cluster.
|
For each set of tasks that are scheduled, compute the new cap values for each host in the cluster.
|
||||||
At regular intervals of time, cap each node in the cluster.
|
At regular intervals of time, cap each node in the cluster.
|
||||||
*/
|
*/
|
||||||
log.Printf("Number of tasks yet to be scheduled: %d", len(s.tasks))
|
|
||||||
|
|
||||||
|
|
||||||
for _, offer := range offers {
|
for _, offer := range offers {
|
||||||
select {
|
select {
|
||||||
case <-s.Shutdown:
|
case <-s.Shutdown:
|
||||||
|
@ -262,8 +250,8 @@ func (s *PistonCapper) ResourceOffers(driver sched.SchedulerDriver, offers []*me
|
||||||
|
|
||||||
for *task.Instances > 0 {
|
for *task.Instances > 0 {
|
||||||
// Does the task fit
|
// Does the task fit
|
||||||
if (s.ignoreWatts || !wattsOverload(task, offerWatts, totalWatts)) &&
|
if (s.ignoreWatts || (offerWatts >= (totalWatts + task.Watts))) &&
|
||||||
(offerCPU >= (totalCPU + task.CPU)) &&
|
(offerCPU >= (totalCPU + task.CPU)) &&
|
||||||
(offerRAM >= (totalRAM + task.RAM)) {
|
(offerRAM >= (totalRAM + task.RAM)) {
|
||||||
|
|
||||||
// Start piston capping if haven't started yet
|
// Start piston capping if haven't started yet
|
||||||
|
@ -273,7 +261,7 @@ func (s *PistonCapper) ResourceOffers(driver sched.SchedulerDriver, offers []*me
|
||||||
}
|
}
|
||||||
|
|
||||||
taken = true
|
taken = true
|
||||||
totalWatts += (task.Watts * constants.CapMargin)
|
totalWatts += task.Watts
|
||||||
totalCPU += task.CPU
|
totalCPU += task.CPU
|
||||||
totalRAM += task.RAM
|
totalRAM += task.RAM
|
||||||
log.Println("Co-Located with: ")
|
log.Println("Co-Located with: ")
|
||||||
|
|
Reference in a new issue