From 62f199773a86324f7e8bf8f9d54ef509e359845c Mon Sep 17 00:00:00 2001 From: Pradyumna Kaushik Date: Sat, 14 Jan 2017 20:04:37 -0500 Subject: [PATCH] formatted the files --- schedulers/binpacksortedwatts.go | 2 +- schedulers/bpMaxMin.go | 4 +--- schedulers/bpMaxMinProacCC.go | 2 +- schedulers/bpswClassMapWattsProacCC.go | 8 ++++---- schedulers/firstfit.go | 2 +- schedulers/firstfitsortedwatts.go | 3 +-- schedulers/firstfitwattsonly.go | 2 +- schedulers/proactiveclusterwidecappingfcfs.go | 5 ++--- schedulers/proactiveclusterwidecappingranked.go | 5 ++--- 9 files changed, 14 insertions(+), 19 deletions(-) diff --git a/schedulers/binpacksortedwatts.go b/schedulers/binpacksortedwatts.go index f8c43ef..fdcc82a 100644 --- a/schedulers/binpacksortedwatts.go +++ b/schedulers/binpacksortedwatts.go @@ -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 diff --git a/schedulers/bpMaxMin.go b/schedulers/bpMaxMin.go index f5f0c5c..9221476 100644 --- a/schedulers/bpMaxMin.go +++ b/schedulers/bpMaxMin.go @@ -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) diff --git a/schedulers/bpMaxMinProacCC.go b/schedulers/bpMaxMinProacCC.go index bda367d..39e96fc 100644 --- a/schedulers/bpMaxMinProacCC.go +++ b/schedulers/bpMaxMinProacCC.go @@ -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() { diff --git a/schedulers/bpswClassMapWattsProacCC.go b/schedulers/bpswClassMapWattsProacCC.go index ddcadc1..19eb393 100644 --- a/schedulers/bpswClassMapWattsProacCC.go +++ b/schedulers/bpswClassMapWattsProacCC.go @@ -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 diff --git a/schedulers/firstfit.go b/schedulers/firstfit.go index d7819de..4eaecdd 100644 --- a/schedulers/firstfit.go +++ b/schedulers/firstfit.go @@ -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 diff --git a/schedulers/firstfitsortedwatts.go b/schedulers/firstfitsortedwatts.go index fbd740c..940ef90 100644 --- a/schedulers/firstfitsortedwatts.go +++ b/schedulers/firstfitsortedwatts.go @@ -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) } - diff --git a/schedulers/firstfitwattsonly.go b/schedulers/firstfitwattsonly.go index 798a5f7..c23727f 100644 --- a/schedulers/firstfitwattsonly.go +++ b/schedulers/firstfitwattsonly.go @@ -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 diff --git a/schedulers/proactiveclusterwidecappingfcfs.go b/schedulers/proactiveclusterwidecappingfcfs.go index 8456c7c..d89390b 100644 --- a/schedulers/proactiveclusterwidecappingfcfs.go +++ b/schedulers/proactiveclusterwidecappingfcfs.go @@ -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) } - diff --git a/schedulers/proactiveclusterwidecappingranked.go b/schedulers/proactiveclusterwidecappingranked.go index 4e9aa82..f4c3484 100644 --- a/schedulers/proactiveclusterwidecappingranked.go +++ b/schedulers/proactiveclusterwidecappingranked.go @@ -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) } -