formatted the files
This commit is contained in:
parent
15c4f04d75
commit
62f199773a
9 changed files with 14 additions and 19 deletions
|
@ -8,10 +8,10 @@ import (
|
|||
"github.com/mesos/mesos-go/mesosutil"
|
||||
sched "github.com/mesos/mesos-go/scheduler"
|
||||
"log"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Decides if to take an offer or not
|
||||
|
|
|
@ -124,7 +124,6 @@ func (s *BPMaxMinWatts) newTask(offer *mesos.Offer, task def.Task) *mesos.TaskIn
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Determine if the remaining space inside of the offer is enough for this
|
||||
// the task we need to create. If it is, create a TaskInfo and return it.
|
||||
func (s *BPMaxMinWatts) CheckFit(i int,
|
||||
|
@ -194,7 +193,7 @@ func (s *BPMaxMinWatts) ResourceOffers(driver sched.SchedulerDriver, offers []*m
|
|||
|
||||
// Attempt to schedule a single instance of the heaviest workload available first
|
||||
// Start from the back until one fits
|
||||
for i:= len(s.tasks)-1; i >= 0; i-- {
|
||||
for i := len(s.tasks) - 1; i >= 0; i-- {
|
||||
|
||||
task := s.tasks[i]
|
||||
// Check host if it exists
|
||||
|
@ -239,7 +238,6 @@ func (s *BPMaxMinWatts) ResourceOffers(driver sched.SchedulerDriver, offers []*m
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if offerTaken {
|
||||
log.Printf("Starting on [%s]\n", offer.GetHostname())
|
||||
driver.LaunchTasks([]*mesos.OfferID{offer.Id}, tasks, defaultFilter)
|
||||
|
|
|
@ -155,7 +155,7 @@ func (s *BPMaxMinProacCC) newTask(offer *mesos.Offer, task def.Task) *mesos.Task
|
|||
}
|
||||
|
||||
// go routine to cap the entire cluster in regular intervals of time.
|
||||
var bpMaxMinProacCCCapValue = 0.0 // initial value to indicate that we haven't capped the cluster yet.
|
||||
var bpMaxMinProacCCCapValue = 0.0 // initial value to indicate that we haven't capped the cluster yet.
|
||||
var bpMaxMinProacCCNewCapValue = 0.0 // newly computed cap value
|
||||
func (s *BPMaxMinProacCC) startCapping() {
|
||||
go func() {
|
||||
|
|
|
@ -165,7 +165,7 @@ func (s *BPSWClassMapWattsProacCC) Disconnected(sched.SchedulerDriver) {
|
|||
}
|
||||
|
||||
// go routine to cap the entire cluster in regular intervals of time.
|
||||
var bpswClassMapWattsProacCCCapValue = 0.0 // initial value to indicate that we haven't capped the cluster yet.
|
||||
var bpswClassMapWattsProacCCCapValue = 0.0 // initial value to indicate that we haven't capped the cluster yet.
|
||||
var bpswClassMapWattsProacCCNewCapValue = 0.0 // newly computed cap value
|
||||
func (s *BPSWClassMapWattsProacCC) startCapping() {
|
||||
go func() {
|
||||
|
@ -208,11 +208,11 @@ func (s *BPSWClassMapWattsProacCC) startRecapping() {
|
|||
if s.isRecapping && bpswClassMapWattsProacCCRecapValue > 0.0 {
|
||||
for _, host := range constants.Hosts {
|
||||
// Rounding capValue to the nearest int
|
||||
if err := rapl.Cap(host, "rapl", int(math.Floor(bpswClassMapWattsProacCCRecapValue +0.5))); err != nil {
|
||||
if err := rapl.Cap(host, "rapl", int(math.Floor(bpswClassMapWattsProacCCRecapValue+0.5))); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
}
|
||||
log.Printf("Recapping the cluster to %d", int(math.Floor(bpswClassMapWattsProacCCRecapValue +0.5)))
|
||||
log.Printf("Recapping the cluster to %d", int(math.Floor(bpswClassMapWattsProacCCRecapValue+0.5)))
|
||||
}
|
||||
// Setting recapping to false
|
||||
s.isRecapping = false
|
||||
|
@ -383,7 +383,7 @@ func (s *BPSWClassMapWattsProacCC) StatusUpdate(driver sched.SchedulerDriver, st
|
|||
tempCap, err := s.capper.CleverRecap(s.totalPower, s.taskMonitor, *status.TaskId.Value)
|
||||
if err == nil {
|
||||
// If new determined cap value is different from the current recap value, then we need to recap
|
||||
if int(math.Floor(tempCap+0.5)) != int(math.Floor(bpswClassMapWattsProacCCRecapValue +0.5)) {
|
||||
if int(math.Floor(tempCap+0.5)) != int(math.Floor(bpswClassMapWattsProacCCRecapValue+0.5)) {
|
||||
bpswClassMapWattsProacCCRecapValue = tempCap
|
||||
bpswClassMapWattsProacCCMutex.Lock()
|
||||
s.isRecapping = true
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"github.com/mesos/mesos-go/mesosutil"
|
||||
sched "github.com/mesos/mesos-go/scheduler"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Decides if to take an offer or not
|
||||
|
|
|
@ -8,10 +8,10 @@ import (
|
|||
"github.com/mesos/mesos-go/mesosutil"
|
||||
sched "github.com/mesos/mesos-go/scheduler"
|
||||
"log"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Decides if to take an offer or not
|
||||
|
@ -216,4 +216,3 @@ func (s *FirstFitSortedWatts) StatusUpdate(driver sched.SchedulerDriver, status
|
|||
}
|
||||
log.Printf("DONE: Task status [%s] for task [%s]", NameFor(status.State), *status.TaskId.Value)
|
||||
}
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"github.com/mesos/mesos-go/mesosutil"
|
||||
sched "github.com/mesos/mesos-go/scheduler"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Decides if to take an offer or not
|
||||
|
|
|
@ -12,10 +12,10 @@ import (
|
|||
sched "github.com/mesos/mesos-go/scheduler"
|
||||
"log"
|
||||
"math"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Decides if to take an offer or not
|
||||
|
@ -30,7 +30,7 @@ func (_ *ProactiveClusterwideCapFCFS) takeOffer(offer *mesos.Offer, task def.Tas
|
|||
|
||||
// electronScheduler implements the Scheduler interface.
|
||||
type ProactiveClusterwideCapFCFS struct {
|
||||
base // Type embedded to inherit common functions
|
||||
base // Type embedded to inherit common functions
|
||||
tasksCreated int
|
||||
tasksRunning int
|
||||
tasks []def.Task
|
||||
|
@ -386,4 +386,3 @@ func (s *ProactiveClusterwideCapFCFS) StatusUpdate(driver sched.SchedulerDriver,
|
|||
}
|
||||
log.Printf("DONE: Task status [%s] for task [%s]", NameFor(status.State), *status.TaskId.Value)
|
||||
}
|
||||
|
||||
|
|
|
@ -22,11 +22,11 @@ import (
|
|||
sched "github.com/mesos/mesos-go/scheduler"
|
||||
"log"
|
||||
"math"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Decides if to taken an offer or not
|
||||
|
@ -41,7 +41,7 @@ func (_ *ProactiveClusterwideCapRanked) takeOffer(offer *mesos.Offer, task def.T
|
|||
|
||||
// electronScheduler implements the Scheduler interface
|
||||
type ProactiveClusterwideCapRanked struct {
|
||||
base // Type embedded to inherit common functions
|
||||
base // Type embedded to inherit common functions
|
||||
tasksCreated int
|
||||
tasksRunning int
|
||||
tasks []def.Task
|
||||
|
@ -410,4 +410,3 @@ func (s *ProactiveClusterwideCapRanked) StatusUpdate(driver sched.SchedulerDrive
|
|||
}
|
||||
log.Printf("DONE: Task status [%s] for task [%s]", NameFor(status.State), *status.TaskId.Value)
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue