Merged in schedulerAttributesConsolidation (pull request #11)
SchedulerAttributesConsolidation Approved-by: Renan DelValle Approved-by: ajain13
This commit is contained in:
commit
ccbe7a14b7
17 changed files with 272 additions and 565 deletions
|
@ -3,7 +3,7 @@ Cluster wide dynamic capping
|
||||||
|
|
||||||
This is a capping strategy that can be used with schedulers to improve the power consumption.
|
This is a capping strategy that can be used with schedulers to improve the power consumption.
|
||||||
|
|
||||||
Note: This capping strategy doesn't currently considered task.Watts to power class mapping with classMapWatts is enabled.
|
Note: This capping strategy doesn't currently consider task.Watts to power class mapping when classMapWatts is enabled.
|
||||||
*/
|
*/
|
||||||
package powerCapping
|
package powerCapping
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,37 @@
|
||||||
package schedulers
|
package schedulers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bitbucket.org/sunybingcloud/electron/def"
|
||||||
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"
|
||||||
)
|
)
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -33,30 +33,7 @@ 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
|
||||||
|
@ -70,15 +47,17 @@ func NewBinPackSortedWattsSortedOffers(tasks []def.Task, wattsAsAResource bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &BinPackSortedWattsSortedOffers{
|
s := &BinPackSortedWattsSortedOffers{
|
||||||
tasks: tasks,
|
base: base{
|
||||||
wattsAsAResource: wattsAsAResource,
|
tasks: tasks,
|
||||||
classMapWatts: classMapWatts,
|
wattsAsAResource: wattsAsAResource,
|
||||||
Shutdown: make(chan struct{}),
|
classMapWatts: classMapWatts,
|
||||||
Done: make(chan struct{}),
|
Shutdown: make(chan struct{}),
|
||||||
PCPLog: make(chan struct{}),
|
Done: make(chan struct{}),
|
||||||
running: make(map[string]map[string]bool),
|
PCPLog: make(chan struct{}),
|
||||||
RecordPCP: false,
|
running: make(map[string]map[string]bool),
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
RecordPCP: false,
|
||||||
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,35 +26,11 @@ import (
|
||||||
corresponding to the load on that node.
|
corresponding to the load on that node.
|
||||||
*/
|
*/
|
||||||
type BinPackedPistonCapper struct {
|
type BinPackedPistonCapper struct {
|
||||||
base // Type embedded to inherit common functions
|
base // Type embedded to inherit common functions
|
||||||
tasksCreated int
|
taskMonitor map[string][]def.Task
|
||||||
tasksRunning int
|
totalPower map[string]float64
|
||||||
tasks []def.Task
|
ticker *time.Ticker
|
||||||
metrics map[string]def.Metric
|
isCapping bool
|
||||||
running map[string]map[string]bool
|
|
||||||
taskMonitor map[string][]def.Task
|
|
||||||
totalPower map[string]float64
|
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
ticker *time.Ticker
|
|
||||||
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.
|
||||||
|
@ -67,19 +43,21 @@ func NewBinPackedPistonCapper(tasks []def.Task, wattsAsAResource bool, schedTrac
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &BinPackedPistonCapper{
|
s := &BinPackedPistonCapper{
|
||||||
tasks: tasks,
|
base: base{
|
||||||
wattsAsAResource: wattsAsAResource,
|
tasks: tasks,
|
||||||
classMapWatts: classMapWatts,
|
wattsAsAResource: wattsAsAResource,
|
||||||
Shutdown: make(chan struct{}),
|
classMapWatts: classMapWatts,
|
||||||
Done: make(chan struct{}),
|
Shutdown: make(chan struct{}),
|
||||||
PCPLog: make(chan struct{}),
|
Done: make(chan struct{}),
|
||||||
running: make(map[string]map[string]bool),
|
PCPLog: make(chan struct{}),
|
||||||
taskMonitor: make(map[string][]def.Task),
|
running: make(map[string]map[string]bool),
|
||||||
totalPower: make(map[string]float64),
|
RecordPCP: false,
|
||||||
RecordPCP: false,
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
ticker: time.NewTicker(5 * time.Second),
|
},
|
||||||
isCapping: false,
|
taskMonitor: make(map[string][]def.Task),
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
totalPower: make(map[string]float64),
|
||||||
|
ticker: time.NewTicker(5 * time.Second),
|
||||||
|
isCapping: false,
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,30 +34,7 @@ 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
|
||||||
|
@ -70,15 +47,17 @@ func NewBinPackSortedWatts(tasks []def.Task, wattsAsAResource bool, schedTracePr
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &BinPackSortedWatts{
|
s := &BinPackSortedWatts{
|
||||||
tasks: tasks,
|
base: base{
|
||||||
wattsAsAResource: wattsAsAResource,
|
tasks: tasks,
|
||||||
classMapWatts: classMapWatts,
|
wattsAsAResource: wattsAsAResource,
|
||||||
Shutdown: make(chan struct{}),
|
classMapWatts: classMapWatts,
|
||||||
Done: make(chan struct{}),
|
Shutdown: make(chan struct{}),
|
||||||
PCPLog: make(chan struct{}),
|
Done: make(chan struct{}),
|
||||||
running: make(map[string]map[string]bool),
|
PCPLog: make(chan struct{}),
|
||||||
RecordPCP: false,
|
running: make(map[string]map[string]bool),
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
RecordPCP: false,
|
||||||
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,30 +54,7 @@ func (s *BottomHeavy) takeOfferFirstFit(offer *mesos.Offer, wattsConsideration f
|
||||||
// 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
|
||||||
|
@ -93,16 +70,18 @@ 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{}),
|
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,
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,34 +34,11 @@ 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
|
||||||
func NewBPMaxMinWatts(tasks []def.Task, wattsAsAResource bool, schedTracePrefix string, classMapWatts bool) *BPSWMaxMinWatts {
|
func NewBPSWMaxMinWatts(tasks []def.Task, wattsAsAResource bool, schedTracePrefix string, classMapWatts bool) *BPSWMaxMinWatts {
|
||||||
sort.Sort(def.WattsSorter(tasks))
|
sort.Sort(def.WattsSorter(tasks))
|
||||||
|
|
||||||
logFile, err := os.Create("./" + schedTracePrefix + "_schedTrace.log")
|
logFile, err := os.Create("./" + schedTracePrefix + "_schedTrace.log")
|
||||||
|
@ -70,15 +47,17 @@ func NewBPMaxMinWatts(tasks []def.Task, wattsAsAResource bool, schedTracePrefix
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &BPSWMaxMinWatts{
|
s := &BPSWMaxMinWatts{
|
||||||
tasks: tasks,
|
base: base{
|
||||||
wattsAsAResource: wattsAsAResource,
|
tasks: tasks,
|
||||||
classMapWatts: classMapWatts,
|
wattsAsAResource: wattsAsAResource,
|
||||||
Shutdown: make(chan struct{}),
|
classMapWatts: classMapWatts,
|
||||||
Done: make(chan struct{}),
|
Shutdown: make(chan struct{}),
|
||||||
PCPLog: make(chan struct{}),
|
Done: make(chan struct{}),
|
||||||
running: make(map[string]map[string]bool),
|
PCPLog: make(chan struct{}),
|
||||||
RecordPCP: false,
|
running: make(map[string]map[string]bool),
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
RecordPCP: false,
|
||||||
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,34 +39,11 @@ 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
|
taskMonitor map[string][]def.Task
|
||||||
tasksRunning int
|
totalPower map[string]float64
|
||||||
tasks []def.Task
|
ticker *time.Ticker
|
||||||
metrics map[string]def.Metric
|
isCapping bool
|
||||||
running map[string]map[string]bool
|
|
||||||
taskMonitor map[string][]def.Task
|
|
||||||
totalPower map[string]float64
|
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
ticker *time.Ticker
|
|
||||||
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
|
||||||
|
@ -80,19 +57,21 @@ func NewBPSWMaxMinPistonCapping(tasks []def.Task, wattsAsAResource bool, schedTr
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &BPSWMaxMinPistonCapping{
|
s := &BPSWMaxMinPistonCapping{
|
||||||
tasks: tasks,
|
base: base{
|
||||||
wattsAsAResource: wattsAsAResource,
|
tasks: tasks,
|
||||||
classMapWatts: classMapWatts,
|
wattsAsAResource: wattsAsAResource,
|
||||||
Shutdown: make(chan struct{}),
|
classMapWatts: classMapWatts,
|
||||||
Done: make(chan struct{}),
|
Shutdown: make(chan struct{}),
|
||||||
PCPLog: make(chan struct{}),
|
Done: make(chan struct{}),
|
||||||
running: make(map[string]map[string]bool),
|
PCPLog: make(chan struct{}),
|
||||||
taskMonitor: make(map[string][]def.Task),
|
running: make(map[string]map[string]bool),
|
||||||
totalPower: make(map[string]float64),
|
RecordPCP: false,
|
||||||
RecordPCP: false,
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
ticker: time.NewTicker(5 * time.Second),
|
},
|
||||||
isCapping: false,
|
taskMonitor: make(map[string][]def.Task),
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
totalPower: make(map[string]float64),
|
||||||
|
ticker: time.NewTicker(5 * time.Second),
|
||||||
|
isCapping: false,
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
|
@ -38,38 +38,15 @@ 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
|
taskMonitor map[string][]def.Task
|
||||||
tasksRunning int
|
availablePower map[string]float64
|
||||||
tasks []def.Task
|
totalPower map[string]float64
|
||||||
metrics map[string]def.Metric
|
capper *powCap.ClusterwideCapper
|
||||||
running map[string]map[string]bool
|
ticker *time.Ticker
|
||||||
taskMonitor map[string][]def.Task
|
recapTicker *time.Ticker
|
||||||
availablePower map[string]float64
|
isCapping bool // indicate whether we are currently performing cluster-wide capping.
|
||||||
totalPower map[string]float64
|
isRecapping bool // indicate whether we are currently performing cluster-wide recapping.
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
capper *powCap.ClusterwideCapper
|
|
||||||
ticker *time.Ticker
|
|
||||||
recapTicker *time.Ticker
|
|
||||||
isCapping bool // indicate whether we are currently performing cluster-wide capping.
|
|
||||||
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
|
||||||
|
@ -82,23 +59,25 @@ func NewBPSWMaxMinProacCC(tasks []def.Task, wattsAsAResource bool, schedTracePre
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &BPSWMaxMinProacCC{
|
s := &BPSWMaxMinProacCC{
|
||||||
tasks: tasks,
|
base: base{
|
||||||
wattsAsAResource: wattsAsAResource,
|
tasks: tasks,
|
||||||
classMapWatts: classMapWatts,
|
wattsAsAResource: wattsAsAResource,
|
||||||
Shutdown: make(chan struct{}),
|
classMapWatts: classMapWatts,
|
||||||
Done: make(chan struct{}),
|
Shutdown: make(chan struct{}),
|
||||||
PCPLog: make(chan struct{}),
|
Done: make(chan struct{}),
|
||||||
running: make(map[string]map[string]bool),
|
PCPLog: make(chan struct{}),
|
||||||
taskMonitor: make(map[string][]def.Task),
|
running: make(map[string]map[string]bool),
|
||||||
availablePower: make(map[string]float64),
|
RecordPCP: false,
|
||||||
totalPower: make(map[string]float64),
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
RecordPCP: false,
|
},
|
||||||
capper: powCap.GetClusterwideCapperInstance(),
|
taskMonitor: make(map[string][]def.Task),
|
||||||
ticker: time.NewTicker(10 * time.Second),
|
availablePower: make(map[string]float64),
|
||||||
recapTicker: time.NewTicker(20 * time.Second),
|
totalPower: make(map[string]float64),
|
||||||
isCapping: false,
|
capper: powCap.GetClusterwideCapperInstance(),
|
||||||
isRecapping: false,
|
ticker: time.NewTicker(10 * time.Second),
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
recapTicker: time.NewTicker(20 * time.Second),
|
||||||
|
isCapping: false,
|
||||||
|
isRecapping: false,
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,30 +35,7 @@ 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
|
||||||
|
@ -70,15 +47,17 @@ func NewFirstFit(tasks []def.Task, wattsAsAResource bool, schedTracePrefix strin
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &FirstFit{
|
s := &FirstFit{
|
||||||
tasks: tasks,
|
base: base{
|
||||||
wattsAsAResource: wattsAsAResource,
|
tasks: tasks,
|
||||||
classMapWatts: classMapWatts,
|
wattsAsAResource: wattsAsAResource,
|
||||||
Shutdown: make(chan struct{}),
|
classMapWatts: classMapWatts,
|
||||||
Done: make(chan struct{}),
|
Shutdown: make(chan struct{}),
|
||||||
PCPLog: make(chan struct{}),
|
Done: make(chan struct{}),
|
||||||
running: make(map[string]map[string]bool),
|
PCPLog: make(chan struct{}),
|
||||||
RecordPCP: false,
|
running: make(map[string]map[string]bool),
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
RecordPCP: false,
|
||||||
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,39 +36,15 @@ 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
|
taskMonitor map[string][]def.Task // store tasks that are currently running.
|
||||||
tasksRunning int
|
availablePower map[string]float64 // available power for each node in the cluster.
|
||||||
tasks []def.Task
|
totalPower map[string]float64 // total power for each node in the cluster.
|
||||||
metrics map[string]def.Metric
|
capper *powCap.ClusterwideCapper
|
||||||
running map[string]map[string]bool
|
ticker *time.Ticker
|
||||||
taskMonitor map[string][]def.Task // store tasks that are currently running.
|
recapTicker *time.Ticker
|
||||||
availablePower map[string]float64 // available power for each node in the cluster.
|
isCapping bool // indicate whether we are currently performing cluster wide capping.
|
||||||
totalPower map[string]float64 // total power for each node in the cluster.
|
isRecapping bool // indicate whether we are currently performing cluster wide re-capping.
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
capper *powCap.ClusterwideCapper
|
|
||||||
ticker *time.Ticker
|
|
||||||
recapTicker *time.Ticker
|
|
||||||
isCapping bool // indicate whether we are currently performing cluster wide 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.
|
||||||
|
@ -81,23 +57,25 @@ func NewFirstFitProacCC(tasks []def.Task, wattsAsAResource bool, schedTracePrefi
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &FirstFitProacCC{
|
s := &FirstFitProacCC{
|
||||||
tasks: tasks,
|
base: base{
|
||||||
wattsAsAResource: wattsAsAResource,
|
tasks: tasks,
|
||||||
classMapWatts: classMapWatts,
|
wattsAsAResource: wattsAsAResource,
|
||||||
Shutdown: make(chan struct{}),
|
classMapWatts: classMapWatts,
|
||||||
Done: make(chan struct{}),
|
Shutdown: make(chan struct{}),
|
||||||
PCPLog: make(chan struct{}),
|
Done: make(chan struct{}),
|
||||||
running: make(map[string]map[string]bool),
|
PCPLog: make(chan struct{}),
|
||||||
taskMonitor: make(map[string][]def.Task),
|
running: make(map[string]map[string]bool),
|
||||||
availablePower: make(map[string]float64),
|
RecordPCP: false,
|
||||||
totalPower: make(map[string]float64),
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
RecordPCP: false,
|
},
|
||||||
capper: powCap.GetClusterwideCapperInstance(),
|
taskMonitor: make(map[string][]def.Task),
|
||||||
ticker: time.NewTicker(10 * time.Second),
|
availablePower: make(map[string]float64),
|
||||||
recapTicker: time.NewTicker(20 * time.Second),
|
totalPower: make(map[string]float64),
|
||||||
isCapping: false,
|
capper: powCap.GetClusterwideCapperInstance(),
|
||||||
isRecapping: false,
|
ticker: time.NewTicker(10 * time.Second),
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
recapTicker: time.NewTicker(20 * time.Second),
|
||||||
|
isCapping: false,
|
||||||
|
isRecapping: false,
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,30 +36,7 @@ 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
|
||||||
|
@ -71,15 +48,17 @@ func NewFirstFitSortedOffers(tasks []def.Task, wattsAsAResource bool, schedTrace
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &FirstFitSortedOffers{
|
s := &FirstFitSortedOffers{
|
||||||
tasks: tasks,
|
base: base{
|
||||||
wattsAsAResource: wattsAsAResource,
|
tasks: tasks,
|
||||||
classMapWatts: classMapWatts,
|
wattsAsAResource: wattsAsAResource,
|
||||||
Shutdown: make(chan struct{}),
|
classMapWatts: classMapWatts,
|
||||||
Done: make(chan struct{}),
|
Shutdown: make(chan struct{}),
|
||||||
PCPLog: make(chan struct{}),
|
Done: make(chan struct{}),
|
||||||
running: make(map[string]map[string]bool),
|
PCPLog: make(chan struct{}),
|
||||||
RecordPCP: false,
|
running: make(map[string]map[string]bool),
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
RecordPCP: false,
|
||||||
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,39 +47,15 @@ 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
|
taskMonitor map[string][]def.Task // store tasks that are currently running.
|
||||||
tasksRunning int
|
availablePower map[string]float64 // available power for each node in the cluster.
|
||||||
tasks []def.Task
|
totalPower map[string]float64 // total power for each node in the cluster.
|
||||||
metrics map[string]def.Metric
|
capper *powCap.ClusterwideCapper
|
||||||
running map[string]map[string]bool
|
ticker *time.Ticker
|
||||||
taskMonitor map[string][]def.Task // store tasks that are currently running.
|
recapTicker *time.Ticker
|
||||||
availablePower map[string]float64 // available power for each node in the cluster.
|
isCapping bool // indicate whether we are currently performing cluster wide capping.
|
||||||
totalPower map[string]float64 // total power for each node in the cluster.
|
isRecapping bool // indicate whether we are currently performing cluster wide re-capping.
|
||||||
wattsAsAResource bool
|
|
||||||
classMapWatts bool
|
|
||||||
capper *powCap.ClusterwideCapper
|
|
||||||
ticker *time.Ticker
|
|
||||||
recapTicker *time.Ticker
|
|
||||||
isCapping bool // indicate whether we are currently performing cluster wide 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.
|
||||||
|
@ -95,23 +71,25 @@ func NewFirstFitSortedWattsProacCC(tasks []def.Task, wattsAsAResource bool, sche
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &FirstFitSortedWattsProacCC{
|
s := &FirstFitSortedWattsProacCC{
|
||||||
tasks: tasks,
|
base: base{
|
||||||
wattsAsAResource: wattsAsAResource,
|
tasks: tasks,
|
||||||
classMapWatts: classMapWatts,
|
wattsAsAResource: wattsAsAResource,
|
||||||
Shutdown: make(chan struct{}),
|
classMapWatts: classMapWatts,
|
||||||
Done: make(chan struct{}),
|
Shutdown: make(chan struct{}),
|
||||||
PCPLog: make(chan struct{}),
|
Done: make(chan struct{}),
|
||||||
running: make(map[string]map[string]bool),
|
PCPLog: make(chan struct{}),
|
||||||
taskMonitor: make(map[string][]def.Task),
|
running: make(map[string]map[string]bool),
|
||||||
availablePower: make(map[string]float64),
|
RecordPCP: false,
|
||||||
totalPower: make(map[string]float64),
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
RecordPCP: false,
|
},
|
||||||
capper: powCap.GetClusterwideCapperInstance(),
|
taskMonitor: make(map[string][]def.Task),
|
||||||
ticker: time.NewTicker(10 * time.Second),
|
availablePower: make(map[string]float64),
|
||||||
recapTicker: time.NewTicker(20 * time.Second),
|
totalPower: make(map[string]float64),
|
||||||
isCapping: false,
|
capper: powCap.GetClusterwideCapperInstance(),
|
||||||
isRecapping: false,
|
ticker: time.NewTicker(10 * time.Second),
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
recapTicker: time.NewTicker(20 * time.Second),
|
||||||
|
isCapping: false,
|
||||||
|
isRecapping: false,
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,30 +36,7 @@ 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
|
||||||
|
@ -75,15 +52,17 @@ func NewFirstFitSortedWattsSortedOffers(tasks []def.Task, wattsAsAResource bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &FirstFitSortedWattsSortedOffers{
|
s := &FirstFitSortedWattsSortedOffers{
|
||||||
tasks: tasks,
|
base: base{
|
||||||
wattsAsAResource: wattsAsAResource,
|
tasks: tasks,
|
||||||
classMapWatts: classMapWatts,
|
wattsAsAResource: wattsAsAResource,
|
||||||
Shutdown: make(chan struct{}),
|
classMapWatts: classMapWatts,
|
||||||
Done: make(chan struct{}),
|
Shutdown: make(chan struct{}),
|
||||||
PCPLog: make(chan struct{}),
|
Done: make(chan struct{}),
|
||||||
running: make(map[string]map[string]bool),
|
PCPLog: make(chan struct{}),
|
||||||
RecordPCP: false,
|
running: make(map[string]map[string]bool),
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
RecordPCP: false,
|
||||||
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,30 +36,7 @@ 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
|
||||||
|
@ -73,15 +50,17 @@ func NewFirstFitSortedWatts(tasks []def.Task, wattsAsAResource bool, schedTraceP
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &FirstFitSortedWatts{
|
s := &FirstFitSortedWatts{
|
||||||
tasks: tasks,
|
base: base{
|
||||||
wattsAsAResource: wattsAsAResource,
|
tasks: tasks,
|
||||||
classMapWatts: classMapWatts,
|
wattsAsAResource: wattsAsAResource,
|
||||||
Shutdown: make(chan struct{}),
|
classMapWatts: classMapWatts,
|
||||||
Done: make(chan struct{}),
|
Shutdown: make(chan struct{}),
|
||||||
PCPLog: make(chan struct{}),
|
Done: make(chan struct{}),
|
||||||
running: make(map[string]map[string]bool),
|
PCPLog: make(chan struct{}),
|
||||||
RecordPCP: false,
|
running: make(map[string]map[string]bool),
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
RecordPCP: false,
|
||||||
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,30 +34,7 @@ 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
|
||||||
|
@ -69,15 +46,17 @@ func NewFirstFitWattsOnly(tasks []def.Task, wattsAsAResource bool, schedTracePre
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &FirstFitWattsOnly{
|
s := &FirstFitWattsOnly{
|
||||||
tasks: tasks,
|
base: base{
|
||||||
wattsAsAResource: wattsAsAResource,
|
tasks: tasks,
|
||||||
classMapWatts: classMapWatts,
|
wattsAsAResource: wattsAsAResource,
|
||||||
Shutdown: make(chan struct{}),
|
classMapWatts: classMapWatts,
|
||||||
Done: make(chan struct{}),
|
Shutdown: make(chan struct{}),
|
||||||
PCPLog: make(chan struct{}),
|
Done: make(chan struct{}),
|
||||||
running: make(map[string]map[string]bool),
|
PCPLog: make(chan struct{}),
|
||||||
RecordPCP: false,
|
running: make(map[string]map[string]bool),
|
||||||
schedTrace: log.New(logFile, "", log.LstdFlags),
|
RecordPCP: false,
|
||||||
|
schedTrace: log.New(logFile, "", log.LstdFlags),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,30 +53,7 @@ func (s *TopHeavy) takeOfferFirstFit(offer *mesos.Offer, wattsConsideration floa
|
||||||
// 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
|
||||||
|
@ -92,16 +69,18 @@ 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{}),
|
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,
|
||||||
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