formatted the files

This commit is contained in:
Pradyumna Kaushik 2017-01-14 20:04:37 -05:00
parent 15c4f04d75
commit 62f199773a
9 changed files with 14 additions and 19 deletions

View file

@ -8,10 +8,10 @@ import (
"github.com/mesos/mesos-go/mesosutil" "github.com/mesos/mesos-go/mesosutil"
sched "github.com/mesos/mesos-go/scheduler" sched "github.com/mesos/mesos-go/scheduler"
"log" "log"
"os"
"sort" "sort"
"strings" "strings"
"time" "time"
"os"
) )
// Decides if to take an offer or not // Decides if to take an offer or not

View file

@ -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 // 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. // the task we need to create. If it is, create a TaskInfo and return it.
func (s *BPMaxMinWatts) CheckFit(i int, 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 // Attempt to schedule a single instance of the heaviest workload available first
// Start from the back until one fits // 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] task := s.tasks[i]
// Check host if it exists // Check host if it exists
@ -239,7 +238,6 @@ func (s *BPMaxMinWatts) ResourceOffers(driver sched.SchedulerDriver, offers []*m
} }
} }
if offerTaken { if offerTaken {
log.Printf("Starting on [%s]\n", offer.GetHostname()) log.Printf("Starting on [%s]\n", offer.GetHostname())
driver.LaunchTasks([]*mesos.OfferID{offer.Id}, tasks, defaultFilter) driver.LaunchTasks([]*mesos.OfferID{offer.Id}, tasks, defaultFilter)

View file

@ -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. // 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 var bpMaxMinProacCCNewCapValue = 0.0 // newly computed cap value
func (s *BPMaxMinProacCC) startCapping() { func (s *BPMaxMinProacCC) startCapping() {
go func() { go func() {

View file

@ -165,7 +165,7 @@ func (s *BPSWClassMapWattsProacCC) Disconnected(sched.SchedulerDriver) {
} }
// go routine to cap the entire cluster in regular intervals of time. // 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 var bpswClassMapWattsProacCCNewCapValue = 0.0 // newly computed cap value
func (s *BPSWClassMapWattsProacCC) startCapping() { func (s *BPSWClassMapWattsProacCC) startCapping() {
go func() { go func() {
@ -208,11 +208,11 @@ func (s *BPSWClassMapWattsProacCC) startRecapping() {
if s.isRecapping && bpswClassMapWattsProacCCRecapValue > 0.0 { if s.isRecapping && bpswClassMapWattsProacCCRecapValue > 0.0 {
for _, host := range constants.Hosts { for _, host := range constants.Hosts {
// Rounding capValue to the nearest int // 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.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 // Setting recapping to false
s.isRecapping = 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) tempCap, err := s.capper.CleverRecap(s.totalPower, s.taskMonitor, *status.TaskId.Value)
if err == nil { if err == nil {
// If new determined cap value is different from the current recap value, then we need to recap // 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 bpswClassMapWattsProacCCRecapValue = tempCap
bpswClassMapWattsProacCCMutex.Lock() bpswClassMapWattsProacCCMutex.Lock()
s.isRecapping = true s.isRecapping = true

View file

@ -8,9 +8,9 @@ import (
"github.com/mesos/mesos-go/mesosutil" "github.com/mesos/mesos-go/mesosutil"
sched "github.com/mesos/mesos-go/scheduler" sched "github.com/mesos/mesos-go/scheduler"
"log" "log"
"os"
"strings" "strings"
"time" "time"
"os"
) )
// Decides if to take an offer or not // Decides if to take an offer or not

View file

@ -8,10 +8,10 @@ import (
"github.com/mesos/mesos-go/mesosutil" "github.com/mesos/mesos-go/mesosutil"
sched "github.com/mesos/mesos-go/scheduler" sched "github.com/mesos/mesos-go/scheduler"
"log" "log"
"os"
"sort" "sort"
"strings" "strings"
"time" "time"
"os"
) )
// Decides if to take an offer or not // 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) log.Printf("DONE: Task status [%s] for task [%s]", NameFor(status.State), *status.TaskId.Value)
} }

View file

@ -8,9 +8,9 @@ import (
"github.com/mesos/mesos-go/mesosutil" "github.com/mesos/mesos-go/mesosutil"
sched "github.com/mesos/mesos-go/scheduler" sched "github.com/mesos/mesos-go/scheduler"
"log" "log"
"os"
"strings" "strings"
"time" "time"
"os"
) )
// Decides if to take an offer or not // Decides if to take an offer or not

View file

@ -12,10 +12,10 @@ import (
sched "github.com/mesos/mesos-go/scheduler" sched "github.com/mesos/mesos-go/scheduler"
"log" "log"
"math" "math"
"os"
"strings" "strings"
"sync" "sync"
"time" "time"
"os"
) )
// Decides if to take an offer or not // 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. // electronScheduler implements the Scheduler interface.
type ProactiveClusterwideCapFCFS struct { type ProactiveClusterwideCapFCFS struct {
base // Type embedded to inherit common functions base // Type embedded to inherit common functions
tasksCreated int tasksCreated int
tasksRunning int tasksRunning int
tasks []def.Task 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) log.Printf("DONE: Task status [%s] for task [%s]", NameFor(status.State), *status.TaskId.Value)
} }

View file

@ -22,11 +22,11 @@ import (
sched "github.com/mesos/mesos-go/scheduler" sched "github.com/mesos/mesos-go/scheduler"
"log" "log"
"math" "math"
"os"
"sort" "sort"
"strings" "strings"
"sync" "sync"
"time" "time"
"os"
) )
// Decides if to taken an offer or not // 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 // electronScheduler implements the Scheduler interface
type ProactiveClusterwideCapRanked struct { type ProactiveClusterwideCapRanked struct {
base // Type embedded to inherit common functions base // Type embedded to inherit common functions
tasksCreated int tasksCreated int
tasksRunning int tasksRunning int
tasks []def.Task 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) log.Printf("DONE: Task status [%s] for task [%s]", NameFor(status.State), *status.TaskId.Value)
} }