Go fmt on the entire project

This commit is contained in:
Renan DelValle 2017-01-03 20:57:25 -05:00
parent b636ff490c
commit 2678032c2c
6 changed files with 18 additions and 18 deletions

View file

@ -8,15 +8,15 @@ import (
) )
type Task struct { type Task struct {
Name string `json:"name"` Name string `json:"name"`
CPU float64 `json:"cpu"` CPU float64 `json:"cpu"`
RAM float64 `json:"ram"` RAM float64 `json:"ram"`
Watts float64 `json:"watts"` Watts float64 `json:"watts"`
Image string `json:"image"` Image string `json:"image"`
CMD string `json:"cmd"` CMD string `json:"cmd"`
Instances *int `json:"inst"` Instances *int `json:"inst"`
Host string `json:"host"` Host string `json:"host"`
TaskID string `json:"taskID"` TaskID string `json:"taskID"`
ClassToWatts map[string]float64 `json:"class_to_watts"` ClassToWatts map[string]float64 `json:"class_to_watts"`
} }

View file

@ -29,7 +29,7 @@ func (tw taskWrapper) ID() string {
} }
// Cluster wide capper // Cluster wide capper
type ClusterwideCapper struct {} type ClusterwideCapper struct{}
// Defining constructor for clusterwideCapper. Please don't call this directly and instead use GetClusterwideCapperInstance() // Defining constructor for clusterwideCapper. Please don't call this directly and instead use GetClusterwideCapperInstance()
func newClusterwideCapper() *ClusterwideCapper { func newClusterwideCapper() *ClusterwideCapper {

View file

@ -2,8 +2,8 @@ package main
import ( import (
"bitbucket.org/sunybingcloud/electron/def" "bitbucket.org/sunybingcloud/electron/def"
"bitbucket.org/sunybingcloud/electron/schedulers"
"bitbucket.org/sunybingcloud/electron/pcp" "bitbucket.org/sunybingcloud/electron/pcp"
"bitbucket.org/sunybingcloud/electron/schedulers"
"flag" "flag"
"fmt" "fmt"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"

View file

@ -170,7 +170,7 @@ func (s *BPSWClassMapWatts) ResourceOffers(driver sched.SchedulerDriver, offers
// Does the task fit // Does the task fit
// OR lazy evaluation. If ignore watts is set to true, second statement won't // OR lazy evaluation. If ignore watts is set to true, second statement won't
// be evaluated. // be evaluated.
if (s.ignoreWatts || (offerWatts >= (totalWatts+task.ClassToWatts[nodeClass]))) && if (s.ignoreWatts || (offerWatts >= (totalWatts + task.ClassToWatts[nodeClass]))) &&
(offerCPU >= (totalCPU + task.CPU)) && (offerCPU >= (totalCPU + task.CPU)) &&
(offerRAM >= (totalRAM + task.RAM)) { (offerRAM >= (totalRAM + task.RAM)) {

View file

@ -264,7 +264,7 @@ func (s *ProactiveClusterwideCapRanked) ResourceOffers(driver sched.SchedulerDri
} }
// sorting the tasks in ascending order of watts. // sorting the tasks in ascending order of watts.
if (len(s.tasks) > 0) { if len(s.tasks) > 0 {
sort.Sort(def.WattsSorter(s.tasks)) sort.Sort(def.WattsSorter(s.tasks))
// calculating the total number of tasks ranked. // calculating the total number of tasks ranked.
numberOfRankedTasks := 0 numberOfRankedTasks := 0

View file

@ -7,8 +7,8 @@ One should implement Val() to be able to use this utility.
package runAvg package runAvg
import ( import (
"errors"
"container/list" "container/list"
"errors"
) )
type Interface interface { type Interface interface {
@ -19,7 +19,7 @@ type Interface interface {
} }
type runningAverageCalculator struct { type runningAverageCalculator struct {
window list.List window list.List
windowSize int windowSize int
currentSum float64 currentSum float64
} }
@ -30,7 +30,7 @@ var racSingleton *runningAverageCalculator
// return single instance // return single instance
func getInstance(curSum float64, wSize int) *runningAverageCalculator { func getInstance(curSum float64, wSize int) *runningAverageCalculator {
if racSingleton == nil { if racSingleton == nil {
racSingleton = &runningAverageCalculator { racSingleton = &runningAverageCalculator{
windowSize: wSize, windowSize: wSize,
currentSum: curSum, currentSum: curSum,
} }
@ -55,7 +55,7 @@ func (rac *runningAverageCalculator) calculate(data Interface) float64 {
elementToRemove := rac.window.Front() elementToRemove := rac.window.Front()
rac.currentSum -= elementToRemove.Value.(Interface).Val() rac.currentSum -= elementToRemove.Value.(Interface).Val()
rac.window.Remove(elementToRemove) rac.window.Remove(elementToRemove)
// adding new element to the window // adding new element to the window
rac.window.PushBack(data) rac.window.PushBack(data)
rac.currentSum += data.Val() rac.currentSum += data.Val()
@ -105,4 +105,4 @@ func Init() {
racSingleton.window.Init() racSingleton.window.Init()
racSingleton.windowSize = 0 racSingleton.windowSize = 0
racSingleton.currentSum = 0.0 racSingleton.currentSum = 0.0
} }