Powercap policy and PCP config from commandline.
Added command line arguments corresponding to powercapping policy and pcp config file path.
This commit is contained in:
parent
b8f2248810
commit
c9d4e66236
4 changed files with 22 additions and 17 deletions
|
@ -17,8 +17,8 @@ import (
|
|||
func Start(quit chan struct{}, logging *bool, logMType chan elekLogDef.LogMessageType,
|
||||
logMsg chan string, pcpConfigFile string, s scheduler.Scheduler) {
|
||||
baseSchedRef := s.(*schedulers.BaseScheduler)
|
||||
const pcpCommand string = "pmdumptext -m -l -f '' -t 1.0 -d , -c "
|
||||
cmd := exec.Command("sh", "-c", pcpCommand, pcpConfigFile)
|
||||
var pcpCommand string = "pmdumptext -m -l -f '' -t 1.0 -d , -c " + pcpConfigFile
|
||||
cmd := exec.Command("sh", "-c", pcpCommand)
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
||||
|
||||
pipe, err := cmd.StdoutPipe()
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThreshold, loThreshold float64,
|
||||
logMType chan elekLogDef.LogMessageType, logMsg chan string, pcpConfigFile string) {
|
||||
|
||||
const pcpCommand string = "pmdumptext -m -l -f '' -t 1.0 -d , -c "
|
||||
var pcpCommand string = "pmdumptext -m -l -f '' -t 1.0 -d , -c " + pcpConfigFile
|
||||
cmd := exec.Command("sh", "-c", pcpCommand, pcpConfigFile)
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ func getNextCapValue(curCapValue float64, precision int) float64 {
|
|||
func StartPCPLogAndProgressiveExtremaCap(quit chan struct{}, logging *bool, hiThreshold, loThreshold float64,
|
||||
logMType chan elekLogDef.LogMessageType, logMsg chan string, pcpConfigFile string) {
|
||||
|
||||
const pcpCommand string = "pmdumptext -m -l -f '' -t 1.0 -d , -c "
|
||||
var pcpCommand string = "pmdumptext -m -l -f '' -t 1.0 -d , -c " + pcpConfigFile
|
||||
cmd := exec.Command("sh", "-c", pcpCommand, pcpConfigFile)
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
||||
|
||||
|
|
31
scheduler.go
31
scheduler.go
|
@ -22,7 +22,7 @@ import (
|
|||
var master = flag.String("master", "", "Location of leading Mesos master -- <mesos-master>:<port>")
|
||||
var tasksFile = flag.String("workload", "", "JSON file containing task definitions")
|
||||
var wattsAsAResource = flag.Bool("wattsAsAResource", false, "Enable Watts as a Resource")
|
||||
var pcpConfigFile = flag.String("pcpConfigFile", "config", "PCP config file name (if file not " +
|
||||
var pcpConfigFile = flag.String("pcpConfigFile", "config", "PCP config file name (if file not "+
|
||||
"present in the same directory, then provide path).")
|
||||
var pcplogPrefix = flag.String("logPrefix", "", "Prefix for pcplog")
|
||||
var powerCapPolicy = flag.String("powercap", "", "Power Capping policy. (default (''), extrema, prog-extrema).")
|
||||
|
@ -43,10 +43,10 @@ func init() {
|
|||
flag.StringVar(master, "m", "", "Location of leading Mesos master (shorthand)")
|
||||
flag.StringVar(tasksFile, "w", "", "JSON file containing task definitions (shorthand)")
|
||||
flag.BoolVar(wattsAsAResource, "waar", false, "Enable Watts as a Resource (shorthand)")
|
||||
flag.StringVar(pcpConfigFile, "pcpCF", "config", "PCP config file name (if not present in" +
|
||||
flag.StringVar(pcpConfigFile, "pcpCF", "config", "PCP config file name (if not present in"+
|
||||
" the same directory, then provide path) (shorthand).")
|
||||
flag.StringVar(pcplogPrefix, "p", "", "Prefix for pcplog (shorthand)")
|
||||
flag.StringVar(powerCapPolicy, "pc", "", "Power Capping policy. (default (''), extrema, prog-extrema) (shorthand).")
|
||||
flag.StringVar(powerCapPolicy, "pc", "", "Power Capping policy. (default (''), extrema, prog-extrema) (shorthand).")
|
||||
flag.Float64Var(hiThreshold, "ht", 700.0, "Upperbound for when we should start capping (shorthand)")
|
||||
flag.Float64Var(loThreshold, "lt", 400.0, "Lowerbound for when we should start uncapping (shorthand)")
|
||||
flag.BoolVar(classMapWatts, "cmw", false, "Enable mapping of watts to power class of node (shorthand)")
|
||||
|
@ -166,20 +166,25 @@ func main() {
|
|||
log.Printf("Unable to create scheduler driver: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Power Capping policy (if required).
|
||||
var noPowercap, extrema, progExtrema bool
|
||||
var powercapValues map[string]struct{} = map[string]struct{} {
|
||||
"": {},
|
||||
"extrema": {},
|
||||
"progExtrema": {},
|
||||
// REQUIRED PARAMETERS.
|
||||
// PCP logging, Power capping and High and Low thresholds.
|
||||
schedOptions = append(schedOptions, schedulers.WithRecordPCP(&recordPCP))
|
||||
schedOptions = append(schedOptions, schedulers.WithPCPLog(pcpLog))
|
||||
var noPowercap bool
|
||||
var extrema bool
|
||||
var progExtrema bool
|
||||
var powercapValues map[string]struct{} = map[string]struct{}{
|
||||
"": {},
|
||||
"extrema": {},
|
||||
"prog-extrema": {},
|
||||
}
|
||||
|
||||
if _, ok := powercapValues[*powerCapPolicy]; !ok {
|
||||
logger.WriteLog(elekLogDef.ERROR, "Incorrect power capping policy specified.")
|
||||
logger.WriteLog(elekLogDef.ERROR, "Incorrect power-capping algorithm specified.")
|
||||
os.Exit(1)
|
||||
} else {
|
||||
// Indicating which power capping policy to use, if any.
|
||||
// Indicating which power capping algorithm to use, if any.
|
||||
// The pcp-logging with/without power capping will be run after the
|
||||
// scheduler has been configured.
|
||||
if *powerCapPolicy == "" {
|
||||
noPowercap = true
|
||||
} else {
|
||||
|
|
Reference in a new issue