Moved all the common scheduler attributes into base.go
This commit is contained in:
parent
57512ac2dd
commit
9dc5bdada2
16 changed files with 270 additions and 563 deletions
|
@ -4,9 +4,34 @@ import (
|
||||||
mesos "github.com/mesos/mesos-go/mesosproto"
|
mesos "github.com/mesos/mesos-go/mesosproto"
|
||||||
sched "github.com/mesos/mesos-go/scheduler"
|
sched "github.com/mesos/mesos-go/scheduler"
|
||||||
"log"
|
"log"
|
||||||
|
"bitbucket.org/sunybingcloud/electron/def"
|
||||||
)
|
)
|
||||||
|
|
||||||
type base struct{}
|
type base struct{
|
||||||
|
tasksCreated int
|
||||||
|
tasksRunning int
|
||||||
|
tasks []def.Task
|
||||||
|
metrics map[string]def.Metric
|
||||||
|
running map[string]map[string]bool
|
||||||
|
wattsAsAResource bool
|
||||||
|
classMapWatts bool
|
||||||
|
|
||||||
|
// First set of PCP values are garbage values, signal to logger to start recording when we're
|
||||||
|
// about to schedule a new task
|
||||||
|
RecordPCP bool
|
||||||
|
|
||||||
|
// This channel is closed when the program receives an interrupt,
|
||||||
|
// signalling that the program should shut down.
|
||||||
|
Shutdown chan struct{}
|
||||||
|
// This channel is closed after shutdown is closed, and only when all
|
||||||
|
// outstanding tasks have been cleaned up
|
||||||
|
Done chan struct{}
|
||||||
|
|
||||||
|
// Controls when to shutdown pcp logging
|
||||||
|
PCPLog chan struct{}
|
||||||
|
|
||||||
|
schedTrace *log.Logger
|
||||||
|
}
|
||||||
|
|
||||||
func (s *base) OfferRescinded(_ sched.SchedulerDriver, offerID *mesos.OfferID) {
|
func (s *base) OfferRescinded(_ sched.SchedulerDriver, offerID *mesos.OfferID) {
|
||||||
log.Printf("Offer %s rescinded", offerID)
|
log.Printf("Offer %s rescinded", offerID)
|
||||||
|
|
|
@ -37,29 +37,6 @@ func (s *BinPackSortedWattsSortedOffers) takeOffer(offer *mesos.Offer, task def.
|
||||||
|
|
||||||
type BinPackSortedWattsSortedOffers struct {
|
type BinPackSortedWattsSortedOffers struct {
|
||||||
base // Type embedded to inherit common functions
|
base // Type embedded to inherit common functions
|
||||||
tasksCreated int
|
|
||||||
tasksRunning int
|
|
||||||
tasks []def.Task
|
|
||||||
metrics map[string]def.Metric
|
|
||||||
running map[string]map[string]bool
|
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
|
|
||||||
// First set of PCP values are garbage values, signal to logger to start recording when we're
|
|
||||||
// about to schedule a new task
|
|
||||||
RecordPCP bool
|
|
||||||
|
|
||||||
// This channel is closed when the program receives an interrupt,
|
|
||||||
// signalling that the program should shut down.
|
|
||||||
Shutdown chan struct{}
|
|
||||||
// This channel is closed after shutdown is closed, and only when all
|
|
||||||
// outstanding tasks have been cleaned up
|
|
||||||
Done chan struct{}
|
|
||||||
|
|
||||||
// Controls when to shutdown pcp logging
|
|
||||||
PCPLog chan struct{}
|
|
||||||
|
|
||||||
schedTrace *log.Logger
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New electron scheduler
|
// New electron scheduler
|
||||||
|
@ -73,6 +50,7 @@ func NewBinPackSortedWattsSortedOffers(tasks []def.Task, wattsAsAResource bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &BinPackSortedWattsSortedOffers{
|
s := &BinPackSortedWattsSortedOffers{
|
||||||
|
base: base{
|
||||||
tasks: tasks,
|
tasks: tasks,
|
||||||
wattsAsAResource: wattsAsAResource,
|
wattsAsAResource: wattsAsAResource,
|
||||||
classMapWatts: classMapWatts,
|
classMapWatts: classMapWatts,
|
||||||
|
@ -82,6 +60,7 @@ func NewBinPackSortedWattsSortedOffers(tasks []def.Task, wattsAsAResource bool,
|
||||||
running: make(map[string]map[string]bool),
|
running: make(map[string]map[string]bool),
|
||||||
RecordPCP: false,
|
RecordPCP: false,
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,34 +28,10 @@ import (
|
||||||
*/
|
*/
|
||||||
type BinPackedPistonCapper struct {
|
type BinPackedPistonCapper struct {
|
||||||
base // Type embedded to inherit common functions
|
base // Type embedded to inherit common functions
|
||||||
tasksCreated int
|
|
||||||
tasksRunning int
|
|
||||||
tasks []def.Task
|
|
||||||
metrics map[string]def.Metric
|
|
||||||
running map[string]map[string]bool
|
|
||||||
taskMonitor map[string][]def.Task
|
taskMonitor map[string][]def.Task
|
||||||
totalPower map[string]float64
|
totalPower map[string]float64
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
ticker *time.Ticker
|
ticker *time.Ticker
|
||||||
isCapping bool
|
isCapping bool
|
||||||
|
|
||||||
// First set of PCP values are garbage values, signal to logger to start recording when we're
|
|
||||||
// about to schedule the new task.
|
|
||||||
RecordPCP bool
|
|
||||||
|
|
||||||
// This channel is closed when the program receives an interrupt,
|
|
||||||
// signalling that the program should shut down.
|
|
||||||
Shutdown chan struct{}
|
|
||||||
|
|
||||||
// This channel is closed after shutdown is closed, and only when all
|
|
||||||
// outstanding tasks have been cleaned up.
|
|
||||||
Done chan struct{}
|
|
||||||
|
|
||||||
// Controls when to shutdown pcp logging.
|
|
||||||
PCPLog chan struct{}
|
|
||||||
|
|
||||||
schedTrace *log.Logger
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New electron scheduler.
|
// New electron scheduler.
|
||||||
|
@ -68,6 +44,7 @@ func NewBinPackedPistonCapper(tasks []def.Task, wattsAsAResource bool, schedTrac
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &BinPackedPistonCapper{
|
s := &BinPackedPistonCapper{
|
||||||
|
base: base{
|
||||||
tasks: tasks,
|
tasks: tasks,
|
||||||
wattsAsAResource: wattsAsAResource,
|
wattsAsAResource: wattsAsAResource,
|
||||||
classMapWatts: classMapWatts,
|
classMapWatts: classMapWatts,
|
||||||
|
@ -75,12 +52,13 @@ func NewBinPackedPistonCapper(tasks []def.Task, wattsAsAResource bool, schedTrac
|
||||||
Done: make(chan struct{}),
|
Done: make(chan struct{}),
|
||||||
PCPLog: make(chan struct{}),
|
PCPLog: make(chan struct{}),
|
||||||
running: make(map[string]map[string]bool),
|
running: make(map[string]map[string]bool),
|
||||||
|
RecordPCP: false,
|
||||||
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
taskMonitor: make(map[string][]def.Task),
|
taskMonitor: make(map[string][]def.Task),
|
||||||
totalPower: make(map[string]float64),
|
totalPower: make(map[string]float64),
|
||||||
RecordPCP: false,
|
|
||||||
ticker: time.NewTicker(5 * time.Second),
|
ticker: time.NewTicker(5 * time.Second),
|
||||||
isCapping: false,
|
isCapping: false,
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,29 +37,6 @@ func (s *BinPackSortedWatts) takeOffer(offer *mesos.Offer, task def.Task) bool {
|
||||||
|
|
||||||
type BinPackSortedWatts struct {
|
type BinPackSortedWatts struct {
|
||||||
base // Type embedded to inherit common functions
|
base // Type embedded to inherit common functions
|
||||||
tasksCreated int
|
|
||||||
tasksRunning int
|
|
||||||
tasks []def.Task
|
|
||||||
metrics map[string]def.Metric
|
|
||||||
running map[string]map[string]bool
|
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
|
|
||||||
// First set of PCP values are garbage values, signal to logger to start recording when we're
|
|
||||||
// about to schedule a new task
|
|
||||||
RecordPCP bool
|
|
||||||
|
|
||||||
// This channel is closed when the program receives an interrupt,
|
|
||||||
// signalling that the program should shut down.
|
|
||||||
Shutdown chan struct{}
|
|
||||||
// This channel is closed after shutdown is closed, and only when all
|
|
||||||
// outstanding tasks have been cleaned up
|
|
||||||
Done chan struct{}
|
|
||||||
|
|
||||||
// Controls when to shutdown pcp logging
|
|
||||||
PCPLog chan struct{}
|
|
||||||
|
|
||||||
schedTrace *log.Logger
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New electron scheduler
|
// New electron scheduler
|
||||||
|
@ -72,6 +49,7 @@ func NewBinPackSortedWatts(tasks []def.Task, wattsAsAResource bool, schedTracePr
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &BinPackSortedWatts{
|
s := &BinPackSortedWatts{
|
||||||
|
base: base{
|
||||||
tasks: tasks,
|
tasks: tasks,
|
||||||
wattsAsAResource: wattsAsAResource,
|
wattsAsAResource: wattsAsAResource,
|
||||||
classMapWatts: classMapWatts,
|
classMapWatts: classMapWatts,
|
||||||
|
@ -81,6 +59,7 @@ func NewBinPackSortedWatts(tasks []def.Task, wattsAsAResource bool, schedTracePr
|
||||||
running: make(map[string]map[string]bool),
|
running: make(map[string]map[string]bool),
|
||||||
RecordPCP: false,
|
RecordPCP: false,
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,30 +29,7 @@ BinPacking has the most effect when co-scheduling of tasks is increased. Large t
|
||||||
// electronScheduler implements the Scheduler interface
|
// electronScheduler implements the Scheduler interface
|
||||||
type BottomHeavy struct {
|
type BottomHeavy struct {
|
||||||
base // Type embedded to inherit common functions
|
base // Type embedded to inherit common functions
|
||||||
tasksCreated int
|
|
||||||
tasksRunning int
|
|
||||||
tasks []def.Task
|
|
||||||
metrics map[string]def.Metric
|
|
||||||
running map[string]map[string]bool
|
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
smallTasks, largeTasks []def.Task
|
smallTasks, largeTasks []def.Task
|
||||||
|
|
||||||
// First set of PCP values are garbage values, signal to logger to start recording when we're
|
|
||||||
// about to schedule a new task
|
|
||||||
RecordPCP bool
|
|
||||||
|
|
||||||
// This channel is closed when the program receives an interrupt,
|
|
||||||
// signalling that the program should shut down.
|
|
||||||
Shutdown chan struct{}
|
|
||||||
// This channel is closed after shutdown is closed, and only when all
|
|
||||||
// outstanding tasks have been cleaned up
|
|
||||||
Done chan struct{}
|
|
||||||
|
|
||||||
// Controls when to shutdown pcp logging
|
|
||||||
PCPLog chan struct{}
|
|
||||||
|
|
||||||
schedTrace *log.Logger
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New electron scheduler
|
// New electron scheduler
|
||||||
|
@ -68,8 +45,7 @@ func NewBottomHeavy(tasks []def.Task, wattsAsAResource bool, schedTracePrefix st
|
||||||
// Classification done based on MMPU watts requirements.
|
// Classification done based on MMPU watts requirements.
|
||||||
mid := int(math.Floor((float64(len(tasks)) / 2.0) + 0.5))
|
mid := int(math.Floor((float64(len(tasks)) / 2.0) + 0.5))
|
||||||
s := &BottomHeavy{
|
s := &BottomHeavy{
|
||||||
smallTasks: tasks[:mid],
|
base: base{
|
||||||
largeTasks: tasks[mid+1:],
|
|
||||||
wattsAsAResource: wattsAsAResource,
|
wattsAsAResource: wattsAsAResource,
|
||||||
classMapWatts: classMapWatts,
|
classMapWatts: classMapWatts,
|
||||||
Shutdown: make(chan struct{}),
|
Shutdown: make(chan struct{}),
|
||||||
|
@ -78,6 +54,9 @@ func NewBottomHeavy(tasks []def.Task, wattsAsAResource bool, schedTracePrefix st
|
||||||
running: make(map[string]map[string]bool),
|
running: make(map[string]map[string]bool),
|
||||||
RecordPCP: false,
|
RecordPCP: false,
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
|
smallTasks: tasks[:mid],
|
||||||
|
largeTasks: tasks[mid+1:],
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,29 +37,6 @@ func (s *BPSWMaxMinWatts) takeOffer(offer *mesos.Offer, task def.Task) bool {
|
||||||
|
|
||||||
type BPSWMaxMinWatts struct {
|
type BPSWMaxMinWatts struct {
|
||||||
base //Type embedding to inherit common functions
|
base //Type embedding to inherit common functions
|
||||||
tasksCreated int
|
|
||||||
tasksRunning int
|
|
||||||
tasks []def.Task
|
|
||||||
metrics map[string]def.Metric
|
|
||||||
running map[string]map[string]bool
|
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
|
|
||||||
// First set of PCP values are garbage values, signal to logger to start recording when we're
|
|
||||||
// about to schedule a new task
|
|
||||||
RecordPCP bool
|
|
||||||
|
|
||||||
// This channel is closed when the program receives an interrupt,
|
|
||||||
// signalling that the program should shut down.
|
|
||||||
Shutdown chan struct{}
|
|
||||||
// This channel is closed after shutdown is closed, and only when all
|
|
||||||
// outstanding tasks have been cleaned up
|
|
||||||
Done chan struct{}
|
|
||||||
|
|
||||||
// Controls when to shutdown pcp logging
|
|
||||||
PCPLog chan struct{}
|
|
||||||
|
|
||||||
schedTrace *log.Logger
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New electron scheduler
|
// New electron scheduler
|
||||||
|
@ -72,6 +49,7 @@ func NewBPMaxMinWatts(tasks []def.Task, wattsAsAResource bool, schedTracePrefix
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &BPSWMaxMinWatts{
|
s := &BPSWMaxMinWatts{
|
||||||
|
base: base{
|
||||||
tasks: tasks,
|
tasks: tasks,
|
||||||
wattsAsAResource: wattsAsAResource,
|
wattsAsAResource: wattsAsAResource,
|
||||||
classMapWatts: classMapWatts,
|
classMapWatts: classMapWatts,
|
||||||
|
@ -81,6 +59,7 @@ func NewBPMaxMinWatts(tasks []def.Task, wattsAsAResource bool, schedTracePrefix
|
||||||
running: make(map[string]map[string]bool),
|
running: make(map[string]map[string]bool),
|
||||||
RecordPCP: false,
|
RecordPCP: false,
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,33 +42,10 @@ func (s *BPSWMaxMinPistonCapping) takeOffer(offer *mesos.Offer, task def.Task) b
|
||||||
|
|
||||||
type BPSWMaxMinPistonCapping struct {
|
type BPSWMaxMinPistonCapping struct {
|
||||||
base //Type embedding to inherit common functions
|
base //Type embedding to inherit common functions
|
||||||
tasksCreated int
|
|
||||||
tasksRunning int
|
|
||||||
tasks []def.Task
|
|
||||||
metrics map[string]def.Metric
|
|
||||||
running map[string]map[string]bool
|
|
||||||
taskMonitor map[string][]def.Task
|
taskMonitor map[string][]def.Task
|
||||||
totalPower map[string]float64
|
totalPower map[string]float64
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
ticker *time.Ticker
|
ticker *time.Ticker
|
||||||
isCapping bool
|
isCapping bool
|
||||||
|
|
||||||
// First set of PCP values are garbage values, signal to logger to start recording when we're
|
|
||||||
// about to schedule a new task
|
|
||||||
RecordPCP bool
|
|
||||||
|
|
||||||
// This channel is closed when the program receives an interrupt,
|
|
||||||
// signalling that the program should shut down.
|
|
||||||
Shutdown chan struct{}
|
|
||||||
// This channel is closed after shutdown is closed, and only when all
|
|
||||||
// outstanding tasks have been cleaned up
|
|
||||||
Done chan struct{}
|
|
||||||
|
|
||||||
// Controls when to shutdown pcp logging
|
|
||||||
PCPLog chan struct{}
|
|
||||||
|
|
||||||
schedTrace *log.Logger
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New electron scheduler
|
// New electron scheduler
|
||||||
|
@ -82,6 +59,7 @@ func NewBPSWMaxMinPistonCapping(tasks []def.Task, wattsAsAResource bool, schedTr
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &BPSWMaxMinPistonCapping{
|
s := &BPSWMaxMinPistonCapping{
|
||||||
|
base: base{
|
||||||
tasks: tasks,
|
tasks: tasks,
|
||||||
wattsAsAResource: wattsAsAResource,
|
wattsAsAResource: wattsAsAResource,
|
||||||
classMapWatts: classMapWatts,
|
classMapWatts: classMapWatts,
|
||||||
|
@ -89,12 +67,13 @@ func NewBPSWMaxMinPistonCapping(tasks []def.Task, wattsAsAResource bool, schedTr
|
||||||
Done: make(chan struct{}),
|
Done: make(chan struct{}),
|
||||||
PCPLog: make(chan struct{}),
|
PCPLog: make(chan struct{}),
|
||||||
running: make(map[string]map[string]bool),
|
running: make(map[string]map[string]bool),
|
||||||
|
RecordPCP: false,
|
||||||
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
taskMonitor: make(map[string][]def.Task),
|
taskMonitor: make(map[string][]def.Task),
|
||||||
totalPower: make(map[string]float64),
|
totalPower: make(map[string]float64),
|
||||||
RecordPCP: false,
|
|
||||||
ticker: time.NewTicker(5 * time.Second),
|
ticker: time.NewTicker(5 * time.Second),
|
||||||
isCapping: false,
|
isCapping: false,
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
|
@ -41,37 +41,14 @@ func (s *BPSWMaxMinProacCC) takeOffer(offer *mesos.Offer, task def.Task) bool {
|
||||||
|
|
||||||
type BPSWMaxMinProacCC struct {
|
type BPSWMaxMinProacCC struct {
|
||||||
base // Type embedding to inherit common functions
|
base // Type embedding to inherit common functions
|
||||||
tasksCreated int
|
|
||||||
tasksRunning int
|
|
||||||
tasks []def.Task
|
|
||||||
metrics map[string]def.Metric
|
|
||||||
running map[string]map[string]bool
|
|
||||||
taskMonitor map[string][]def.Task
|
taskMonitor map[string][]def.Task
|
||||||
availablePower map[string]float64
|
availablePower map[string]float64
|
||||||
totalPower map[string]float64
|
totalPower map[string]float64
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
capper *powCap.ClusterwideCapper
|
capper *powCap.ClusterwideCapper
|
||||||
ticker *time.Ticker
|
ticker *time.Ticker
|
||||||
recapTicker *time.Ticker
|
recapTicker *time.Ticker
|
||||||
isCapping bool // indicate whether we are currently performing cluster-wide capping.
|
isCapping bool // indicate whether we are currently performing cluster-wide capping.
|
||||||
isRecapping bool // indicate whether we are currently performing cluster-wide recapping.
|
isRecapping bool // indicate whether we are currently performing cluster-wide recapping.
|
||||||
|
|
||||||
// First set of PCP values are garbage values, signal to logger to start recording when we're
|
|
||||||
// about to schedule a new task
|
|
||||||
RecordPCP bool
|
|
||||||
|
|
||||||
// This channel is closed when the program receives an interrupt,
|
|
||||||
// signalling that the program should shut down
|
|
||||||
Shutdown chan struct{}
|
|
||||||
// This channel is closed after shutdown is closed, and only when all
|
|
||||||
// outstanding tasks have been cleaned up
|
|
||||||
Done chan struct{}
|
|
||||||
|
|
||||||
// Controls when to shutdown pcp logging
|
|
||||||
PCPLog chan struct{}
|
|
||||||
|
|
||||||
schedTrace *log.Logger
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New electron scheduler
|
// New electron scheduler
|
||||||
|
@ -84,6 +61,7 @@ func NewBPSWMaxMinProacCC(tasks []def.Task, wattsAsAResource bool, schedTracePre
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &BPSWMaxMinProacCC{
|
s := &BPSWMaxMinProacCC{
|
||||||
|
base: base{
|
||||||
tasks: tasks,
|
tasks: tasks,
|
||||||
wattsAsAResource: wattsAsAResource,
|
wattsAsAResource: wattsAsAResource,
|
||||||
classMapWatts: classMapWatts,
|
classMapWatts: classMapWatts,
|
||||||
|
@ -91,16 +69,17 @@ func NewBPSWMaxMinProacCC(tasks []def.Task, wattsAsAResource bool, schedTracePre
|
||||||
Done: make(chan struct{}),
|
Done: make(chan struct{}),
|
||||||
PCPLog: make(chan struct{}),
|
PCPLog: make(chan struct{}),
|
||||||
running: make(map[string]map[string]bool),
|
running: make(map[string]map[string]bool),
|
||||||
|
RecordPCP: false,
|
||||||
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
taskMonitor: make(map[string][]def.Task),
|
taskMonitor: make(map[string][]def.Task),
|
||||||
availablePower: make(map[string]float64),
|
availablePower: make(map[string]float64),
|
||||||
totalPower: make(map[string]float64),
|
totalPower: make(map[string]float64),
|
||||||
RecordPCP: false,
|
|
||||||
capper: powCap.GetClusterwideCapperInstance(),
|
capper: powCap.GetClusterwideCapperInstance(),
|
||||||
ticker: time.NewTicker(10 * time.Second),
|
ticker: time.NewTicker(10 * time.Second),
|
||||||
recapTicker: time.NewTicker(20 * time.Second),
|
recapTicker: time.NewTicker(20 * time.Second),
|
||||||
isCapping: false,
|
isCapping: false,
|
||||||
isRecapping: false,
|
isRecapping: false,
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,29 +37,6 @@ func (s *FirstFit) takeOffer(offer *mesos.Offer, task def.Task) bool {
|
||||||
// electronScheduler implements the Scheduler interface
|
// electronScheduler implements the Scheduler interface
|
||||||
type FirstFit struct {
|
type FirstFit struct {
|
||||||
base // Type embedded to inherit common functions
|
base // Type embedded to inherit common functions
|
||||||
tasksCreated int
|
|
||||||
tasksRunning int
|
|
||||||
tasks []def.Task
|
|
||||||
metrics map[string]def.Metric
|
|
||||||
running map[string]map[string]bool
|
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
|
|
||||||
// First set of PCP values are garbage values, signal to logger to start recording when we're
|
|
||||||
// about to schedule a new task
|
|
||||||
RecordPCP bool
|
|
||||||
|
|
||||||
// This channel is closed when the program receives an interrupt,
|
|
||||||
// signalling that the program should shut down.
|
|
||||||
Shutdown chan struct{}
|
|
||||||
// This channel is closed after shutdown is closed, and only when all
|
|
||||||
// outstanding tasks have been cleaned up
|
|
||||||
Done chan struct{}
|
|
||||||
|
|
||||||
// Controls when to shutdown pcp logging
|
|
||||||
PCPLog chan struct{}
|
|
||||||
|
|
||||||
schedTrace *log.Logger
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New electron scheduler
|
// New electron scheduler
|
||||||
|
@ -71,6 +48,7 @@ func NewFirstFit(tasks []def.Task, wattsAsAResource bool, schedTracePrefix strin
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &FirstFit{
|
s := &FirstFit{
|
||||||
|
base: base{
|
||||||
tasks: tasks,
|
tasks: tasks,
|
||||||
wattsAsAResource: wattsAsAResource,
|
wattsAsAResource: wattsAsAResource,
|
||||||
classMapWatts: classMapWatts,
|
classMapWatts: classMapWatts,
|
||||||
|
@ -80,6 +58,7 @@ func NewFirstFit(tasks []def.Task, wattsAsAResource bool, schedTracePrefix strin
|
||||||
running: make(map[string]map[string]bool),
|
running: make(map[string]map[string]bool),
|
||||||
RecordPCP: false,
|
RecordPCP: false,
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,38 +38,14 @@ func (s *FirstFitProacCC) takeOffer(offer *mesos.Offer, task def.Task) bool {
|
||||||
// electronScheduler implements the Scheduler interface.
|
// electronScheduler implements the Scheduler interface.
|
||||||
type FirstFitProacCC struct {
|
type FirstFitProacCC struct {
|
||||||
base // Type embedded to inherit common functions
|
base // Type embedded to inherit common functions
|
||||||
tasksCreated int
|
|
||||||
tasksRunning int
|
|
||||||
tasks []def.Task
|
|
||||||
metrics map[string]def.Metric
|
|
||||||
running map[string]map[string]bool
|
|
||||||
taskMonitor map[string][]def.Task // store tasks that are currently running.
|
taskMonitor map[string][]def.Task // store tasks that are currently running.
|
||||||
availablePower map[string]float64 // available power for each node in the cluster.
|
availablePower map[string]float64 // available power for each node in the cluster.
|
||||||
totalPower map[string]float64 // total power for each node in the cluster.
|
totalPower map[string]float64 // total power for each node in the cluster.
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
capper *powCap.ClusterwideCapper
|
capper *powCap.ClusterwideCapper
|
||||||
ticker *time.Ticker
|
ticker *time.Ticker
|
||||||
recapTicker *time.Ticker
|
recapTicker *time.Ticker
|
||||||
isCapping bool // indicate whether we are currently performing cluster wide capping.
|
isCapping bool // indicate whether we are currently performing cluster wide capping.
|
||||||
isRecapping bool // indicate whether we are currently performing cluster wide re-capping.
|
isRecapping bool // indicate whether we are currently performing cluster wide re-capping.
|
||||||
|
|
||||||
// First set of PCP values are garbage values, signal to logger to start recording when we're
|
|
||||||
// about to schedule the new task.
|
|
||||||
RecordPCP bool
|
|
||||||
|
|
||||||
// This channel is closed when the program receives an interrupt,
|
|
||||||
// signalling that the program should shut down.
|
|
||||||
Shutdown chan struct{}
|
|
||||||
|
|
||||||
// This channel is closed after shutdown is closed, and only when all
|
|
||||||
// outstanding tasks have been cleaned up.
|
|
||||||
Done chan struct{}
|
|
||||||
|
|
||||||
// Controls when to shutdown pcp logging.
|
|
||||||
PCPLog chan struct{}
|
|
||||||
|
|
||||||
schedTrace *log.Logger
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New electron scheduler.
|
// New electron scheduler.
|
||||||
|
@ -82,6 +58,7 @@ func NewFirstFitProacCC(tasks []def.Task, wattsAsAResource bool, schedTracePrefi
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &FirstFitProacCC{
|
s := &FirstFitProacCC{
|
||||||
|
base: base{
|
||||||
tasks: tasks,
|
tasks: tasks,
|
||||||
wattsAsAResource: wattsAsAResource,
|
wattsAsAResource: wattsAsAResource,
|
||||||
classMapWatts: classMapWatts,
|
classMapWatts: classMapWatts,
|
||||||
|
@ -89,16 +66,17 @@ func NewFirstFitProacCC(tasks []def.Task, wattsAsAResource bool, schedTracePrefi
|
||||||
Done: make(chan struct{}),
|
Done: make(chan struct{}),
|
||||||
PCPLog: make(chan struct{}),
|
PCPLog: make(chan struct{}),
|
||||||
running: make(map[string]map[string]bool),
|
running: make(map[string]map[string]bool),
|
||||||
|
RecordPCP: false,
|
||||||
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
taskMonitor: make(map[string][]def.Task),
|
taskMonitor: make(map[string][]def.Task),
|
||||||
availablePower: make(map[string]float64),
|
availablePower: make(map[string]float64),
|
||||||
totalPower: make(map[string]float64),
|
totalPower: make(map[string]float64),
|
||||||
RecordPCP: false,
|
|
||||||
capper: powCap.GetClusterwideCapperInstance(),
|
capper: powCap.GetClusterwideCapperInstance(),
|
||||||
ticker: time.NewTicker(10 * time.Second),
|
ticker: time.NewTicker(10 * time.Second),
|
||||||
recapTicker: time.NewTicker(20 * time.Second),
|
recapTicker: time.NewTicker(20 * time.Second),
|
||||||
isCapping: false,
|
isCapping: false,
|
||||||
isRecapping: false,
|
isRecapping: false,
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,29 +38,6 @@ func (s *FirstFitSortedOffers) takeOffer(offer *mesos.Offer, task def.Task) bool
|
||||||
// electronScheduler implements the Scheduler interface
|
// electronScheduler implements the Scheduler interface
|
||||||
type FirstFitSortedOffers struct {
|
type FirstFitSortedOffers struct {
|
||||||
base // Type embedded to inherit common functions
|
base // Type embedded to inherit common functions
|
||||||
tasksCreated int
|
|
||||||
tasksRunning int
|
|
||||||
tasks []def.Task
|
|
||||||
metrics map[string]def.Metric
|
|
||||||
running map[string]map[string]bool
|
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
|
|
||||||
// First set of PCP values are garbage values, signal to logger to start recording when we're
|
|
||||||
// about to schedule a new task
|
|
||||||
RecordPCP bool
|
|
||||||
|
|
||||||
// This channel is closed when the program receives an interrupt,
|
|
||||||
// signalling that the program should shut down.
|
|
||||||
Shutdown chan struct{}
|
|
||||||
// This channel is closed after shutdown is closed, and only when all
|
|
||||||
// outstanding tasks have been cleaned up
|
|
||||||
Done chan struct{}
|
|
||||||
|
|
||||||
// Controls when to shutdown pcp logging
|
|
||||||
PCPLog chan struct{}
|
|
||||||
|
|
||||||
schedTrace *log.Logger
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New electron scheduler
|
// New electron scheduler
|
||||||
|
@ -72,6 +49,7 @@ func NewFirstFitSortedOffers(tasks []def.Task, wattsAsAResource bool, schedTrace
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &FirstFitSortedOffers{
|
s := &FirstFitSortedOffers{
|
||||||
|
base: base{
|
||||||
tasks: tasks,
|
tasks: tasks,
|
||||||
wattsAsAResource: wattsAsAResource,
|
wattsAsAResource: wattsAsAResource,
|
||||||
classMapWatts: classMapWatts,
|
classMapWatts: classMapWatts,
|
||||||
|
@ -81,6 +59,7 @@ func NewFirstFitSortedOffers(tasks []def.Task, wattsAsAResource bool, schedTrace
|
||||||
running: make(map[string]map[string]bool),
|
running: make(map[string]map[string]bool),
|
||||||
RecordPCP: false,
|
RecordPCP: false,
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,38 +49,14 @@ func (s *FirstFitSortedWattsProacCC) takeOffer(offer *mesos.Offer, task def.Task
|
||||||
// electronScheduler implements the Scheduler interface
|
// electronScheduler implements the Scheduler interface
|
||||||
type FirstFitSortedWattsProacCC struct {
|
type FirstFitSortedWattsProacCC struct {
|
||||||
base // Type embedded to inherit common functions
|
base // Type embedded to inherit common functions
|
||||||
tasksCreated int
|
|
||||||
tasksRunning int
|
|
||||||
tasks []def.Task
|
|
||||||
metrics map[string]def.Metric
|
|
||||||
running map[string]map[string]bool
|
|
||||||
taskMonitor map[string][]def.Task // store tasks that are currently running.
|
taskMonitor map[string][]def.Task // store tasks that are currently running.
|
||||||
availablePower map[string]float64 // available power for each node in the cluster.
|
availablePower map[string]float64 // available power for each node in the cluster.
|
||||||
totalPower map[string]float64 // total power for each node in the cluster.
|
totalPower map[string]float64 // total power for each node in the cluster.
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
capper *powCap.ClusterwideCapper
|
capper *powCap.ClusterwideCapper
|
||||||
ticker *time.Ticker
|
ticker *time.Ticker
|
||||||
recapTicker *time.Ticker
|
recapTicker *time.Ticker
|
||||||
isCapping bool // indicate whether we are currently performing cluster wide capping.
|
isCapping bool // indicate whether we are currently performing cluster wide capping.
|
||||||
isRecapping bool // indicate whether we are currently performing cluster wide re-capping.
|
isRecapping bool // indicate whether we are currently performing cluster wide re-capping.
|
||||||
|
|
||||||
// First set of PCP values are garbage values, signal to logger to start recording when we're
|
|
||||||
// about to schedule the new task.
|
|
||||||
RecordPCP bool
|
|
||||||
|
|
||||||
// This channel is closed when the program receives an interrupt,
|
|
||||||
// signalling that the program should shut down.
|
|
||||||
Shutdown chan struct{}
|
|
||||||
|
|
||||||
// This channel is closed after shutdown is closed, and only when all
|
|
||||||
// outstanding tasks have been cleaned up.
|
|
||||||
Done chan struct{}
|
|
||||||
|
|
||||||
// Controls when to shutdown pcp logging.
|
|
||||||
PCPLog chan struct{}
|
|
||||||
|
|
||||||
schedTrace *log.Logger
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New electron scheduler.
|
// New electron scheduler.
|
||||||
|
@ -96,6 +72,7 @@ func NewFirstFitSortedWattsProacCC(tasks []def.Task, wattsAsAResource bool, sche
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &FirstFitSortedWattsProacCC{
|
s := &FirstFitSortedWattsProacCC{
|
||||||
|
base: base{
|
||||||
tasks: tasks,
|
tasks: tasks,
|
||||||
wattsAsAResource: wattsAsAResource,
|
wattsAsAResource: wattsAsAResource,
|
||||||
classMapWatts: classMapWatts,
|
classMapWatts: classMapWatts,
|
||||||
|
@ -103,16 +80,17 @@ func NewFirstFitSortedWattsProacCC(tasks []def.Task, wattsAsAResource bool, sche
|
||||||
Done: make(chan struct{}),
|
Done: make(chan struct{}),
|
||||||
PCPLog: make(chan struct{}),
|
PCPLog: make(chan struct{}),
|
||||||
running: make(map[string]map[string]bool),
|
running: make(map[string]map[string]bool),
|
||||||
|
RecordPCP: false,
|
||||||
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
taskMonitor: make(map[string][]def.Task),
|
taskMonitor: make(map[string][]def.Task),
|
||||||
availablePower: make(map[string]float64),
|
availablePower: make(map[string]float64),
|
||||||
totalPower: make(map[string]float64),
|
totalPower: make(map[string]float64),
|
||||||
RecordPCP: false,
|
|
||||||
capper: powCap.GetClusterwideCapperInstance(),
|
capper: powCap.GetClusterwideCapperInstance(),
|
||||||
ticker: time.NewTicker(10 * time.Second),
|
ticker: time.NewTicker(10 * time.Second),
|
||||||
recapTicker: time.NewTicker(20 * time.Second),
|
recapTicker: time.NewTicker(20 * time.Second),
|
||||||
isCapping: false,
|
isCapping: false,
|
||||||
isRecapping: false,
|
isRecapping: false,
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,29 +38,6 @@ func (s *FirstFitSortedWattsSortedOffers) takeOffer(offer *mesos.Offer, task def
|
||||||
// electronScheduler implements the Scheduler interface
|
// electronScheduler implements the Scheduler interface
|
||||||
type FirstFitSortedWattsSortedOffers struct {
|
type FirstFitSortedWattsSortedOffers struct {
|
||||||
base // Type embedded to inherit common functions
|
base // Type embedded to inherit common functions
|
||||||
tasksCreated int
|
|
||||||
tasksRunning int
|
|
||||||
tasks []def.Task
|
|
||||||
metrics map[string]def.Metric
|
|
||||||
running map[string]map[string]bool
|
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
|
|
||||||
// First set of PCP values are garbage values, signal to logger to start recording when we're
|
|
||||||
// about to schedule a new task
|
|
||||||
RecordPCP bool
|
|
||||||
|
|
||||||
// This channel is closed when the program receives an interrupt,
|
|
||||||
// signalling that the program should shut down.
|
|
||||||
Shutdown chan struct{}
|
|
||||||
// This channel is closed after shutdown is closed, and only when all
|
|
||||||
// outstanding tasks have been cleaned up
|
|
||||||
Done chan struct{}
|
|
||||||
|
|
||||||
// Controls when to shutdown pcp logging
|
|
||||||
PCPLog chan struct{}
|
|
||||||
|
|
||||||
schedTrace *log.Logger
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New electron scheduler
|
// New electron scheduler
|
||||||
|
@ -76,6 +53,7 @@ func NewFirstFitSortedWattsSortedOffers(tasks []def.Task, wattsAsAResource bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &FirstFitSortedWattsSortedOffers{
|
s := &FirstFitSortedWattsSortedOffers{
|
||||||
|
base: base{
|
||||||
tasks: tasks,
|
tasks: tasks,
|
||||||
wattsAsAResource: wattsAsAResource,
|
wattsAsAResource: wattsAsAResource,
|
||||||
classMapWatts: classMapWatts,
|
classMapWatts: classMapWatts,
|
||||||
|
@ -85,6 +63,7 @@ func NewFirstFitSortedWattsSortedOffers(tasks []def.Task, wattsAsAResource bool,
|
||||||
running: make(map[string]map[string]bool),
|
running: make(map[string]map[string]bool),
|
||||||
RecordPCP: false,
|
RecordPCP: false,
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,29 +38,6 @@ func (s *FirstFitSortedWatts) takeOffer(offer *mesos.Offer, task def.Task) bool
|
||||||
// electronScheduler implements the Scheduler interface
|
// electronScheduler implements the Scheduler interface
|
||||||
type FirstFitSortedWatts struct {
|
type FirstFitSortedWatts struct {
|
||||||
base // Type embedded to inherit common functions
|
base // Type embedded to inherit common functions
|
||||||
tasksCreated int
|
|
||||||
tasksRunning int
|
|
||||||
tasks []def.Task
|
|
||||||
metrics map[string]def.Metric
|
|
||||||
running map[string]map[string]bool
|
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
|
|
||||||
// First set of PCP values are garbage values, signal to logger to start recording when we're
|
|
||||||
// about to schedule a new task
|
|
||||||
RecordPCP bool
|
|
||||||
|
|
||||||
// This channel is closed when the program receives an interrupt,
|
|
||||||
// signalling that the program should shut down.
|
|
||||||
Shutdown chan struct{}
|
|
||||||
// This channel is closed after shutdown is closed, and only when all
|
|
||||||
// outstanding tasks have been cleaned up
|
|
||||||
Done chan struct{}
|
|
||||||
|
|
||||||
// Controls when to shutdown pcp logging
|
|
||||||
PCPLog chan struct{}
|
|
||||||
|
|
||||||
schedTrace *log.Logger
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New electron scheduler
|
// New electron scheduler
|
||||||
|
@ -74,6 +51,7 @@ func NewFirstFitSortedWatts(tasks []def.Task, wattsAsAResource bool, schedTraceP
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &FirstFitSortedWatts{
|
s := &FirstFitSortedWatts{
|
||||||
|
base: base{
|
||||||
tasks: tasks,
|
tasks: tasks,
|
||||||
wattsAsAResource: wattsAsAResource,
|
wattsAsAResource: wattsAsAResource,
|
||||||
classMapWatts: classMapWatts,
|
classMapWatts: classMapWatts,
|
||||||
|
@ -83,6 +61,7 @@ func NewFirstFitSortedWatts(tasks []def.Task, wattsAsAResource bool, schedTraceP
|
||||||
running: make(map[string]map[string]bool),
|
running: make(map[string]map[string]bool),
|
||||||
RecordPCP: false,
|
RecordPCP: false,
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,29 +36,6 @@ func (s *FirstFitWattsOnly) takeOffer(offer *mesos.Offer, task def.Task) bool {
|
||||||
|
|
||||||
type FirstFitWattsOnly struct {
|
type FirstFitWattsOnly struct {
|
||||||
base // Type embedded to inherit common functions
|
base // Type embedded to inherit common functions
|
||||||
tasksCreated int
|
|
||||||
tasksRunning int
|
|
||||||
tasks []def.Task
|
|
||||||
metrics map[string]def.Metric
|
|
||||||
running map[string]map[string]bool
|
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
|
|
||||||
// First set of PCP values are garbage values, signal to logger to start recording when we're
|
|
||||||
// about to schedule a new task
|
|
||||||
RecordPCP bool
|
|
||||||
|
|
||||||
// This channel is closed when the program receives an interrupt,
|
|
||||||
// signalling that the program should shut down.
|
|
||||||
Shutdown chan struct{}
|
|
||||||
// This channel is closed after shutdown is closed, and only when all
|
|
||||||
// outstanding tasks have been cleaned up
|
|
||||||
Done chan struct{}
|
|
||||||
|
|
||||||
// Controls when to shutdown pcp logging
|
|
||||||
PCPLog chan struct{}
|
|
||||||
|
|
||||||
schedTrace *log.Logger
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New electron scheduler
|
// New electron scheduler
|
||||||
|
@ -70,6 +47,7 @@ func NewFirstFitWattsOnly(tasks []def.Task, wattsAsAResource bool, schedTracePre
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &FirstFitWattsOnly{
|
s := &FirstFitWattsOnly{
|
||||||
|
base: base{
|
||||||
tasks: tasks,
|
tasks: tasks,
|
||||||
wattsAsAResource: wattsAsAResource,
|
wattsAsAResource: wattsAsAResource,
|
||||||
classMapWatts: classMapWatts,
|
classMapWatts: classMapWatts,
|
||||||
|
@ -79,6 +57,7 @@ func NewFirstFitWattsOnly(tasks []def.Task, wattsAsAResource bool, schedTracePre
|
||||||
running: make(map[string]map[string]bool),
|
running: make(map[string]map[string]bool),
|
||||||
RecordPCP: false,
|
RecordPCP: false,
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,30 +29,7 @@ starvation of power intensive tasks.
|
||||||
// electronScheduler implements the Scheduler interface
|
// electronScheduler implements the Scheduler interface
|
||||||
type TopHeavy struct {
|
type TopHeavy struct {
|
||||||
base // Type embedded to inherit common functions
|
base // Type embedded to inherit common functions
|
||||||
tasksCreated int
|
|
||||||
tasksRunning int
|
|
||||||
tasks []def.Task
|
|
||||||
metrics map[string]def.Metric
|
|
||||||
running map[string]map[string]bool
|
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
smallTasks, largeTasks []def.Task
|
smallTasks, largeTasks []def.Task
|
||||||
|
|
||||||
// First set of PCP values are garbage values, signal to logger to start recording when we're
|
|
||||||
// about to schedule a new task
|
|
||||||
RecordPCP bool
|
|
||||||
|
|
||||||
// This channel is closed when the program receives an interrupt,
|
|
||||||
// signalling that the program should shut down.
|
|
||||||
Shutdown chan struct{}
|
|
||||||
// This channel is closed after shutdown is closed, and only when all
|
|
||||||
// outstanding tasks have been cleaned up
|
|
||||||
Done chan struct{}
|
|
||||||
|
|
||||||
// Controls when to shutdown pcp logging
|
|
||||||
PCPLog chan struct{}
|
|
||||||
|
|
||||||
schedTrace *log.Logger
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New electron scheduler
|
// New electron scheduler
|
||||||
|
@ -68,8 +45,7 @@ func NewTopHeavy(tasks []def.Task, wattsAsAResource bool, schedTracePrefix strin
|
||||||
// Classification done based on MMPU watts requirements.
|
// Classification done based on MMPU watts requirements.
|
||||||
mid := int(math.Floor((float64(len(tasks)) / 2.0) + 0.5))
|
mid := int(math.Floor((float64(len(tasks)) / 2.0) + 0.5))
|
||||||
s := &TopHeavy{
|
s := &TopHeavy{
|
||||||
smallTasks: tasks[:mid],
|
base: base{
|
||||||
largeTasks: tasks[mid+1:],
|
|
||||||
wattsAsAResource: wattsAsAResource,
|
wattsAsAResource: wattsAsAResource,
|
||||||
classMapWatts: classMapWatts,
|
classMapWatts: classMapWatts,
|
||||||
Shutdown: make(chan struct{}),
|
Shutdown: make(chan struct{}),
|
||||||
|
@ -78,6 +54,9 @@ func NewTopHeavy(tasks []def.Task, wattsAsAResource bool, schedTracePrefix strin
|
||||||
running: make(map[string]map[string]bool),
|
running: make(map[string]map[string]bool),
|
||||||
RecordPCP: false,
|
RecordPCP: false,
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
|
smallTasks: tasks[:mid],
|
||||||
|
largeTasks: tasks[mid+1:],
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue