Removed ERROR, GENERAL, SUCCESS, WARNING log types

This commit is contained in:
balandi1 2019-11-21 14:58:14 -05:00
parent 268df3cd51
commit cb5df9acc8
11 changed files with 71 additions and 76 deletions

View file

@ -43,7 +43,7 @@ func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThresh
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
if hiThreshold < loThreshold {
elekLog.ElektronLog.Log(elekLogTypes.GENERAL,
elekLog.ElektronLog.Log(elekLogTypes.CONSOLE,
log.InfoLevel,
log.Fields{}, "High threshold is lower than low threshold!")
}
@ -99,7 +99,7 @@ func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThresh
if *logging {
elekLog.ElektronLog.Log(elekLogTypes.GENERAL,
elekLog.ElektronLog.Log(elekLogTypes.CONSOLE,
log.InfoLevel,
log.Fields{}, "Logging PCP...")
@ -119,7 +119,7 @@ func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThresh
powerHistories[host].Value = power
powerHistories[host] = powerHistories[host].Next()
elekLog.ElektronLog.Log(elekLogTypes.GENERAL,
elekLog.ElektronLog.Log(elekLogTypes.CONSOLE,
log.InfoLevel,
log.Fields{"Host": fmt.Sprintf("%s", indexToHost[powerIndex]), "Power": fmt.Sprintf("%f", (power * pcp.RAPLUnits))},
"")
@ -133,14 +133,14 @@ func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThresh
clusterMean := pcp.AverageClusterPowerHistory(clusterPowerHist)
elekLog.ElektronLog.Log(elekLogTypes.GENERAL,
elekLog.ElektronLog.Log(elekLogTypes.CONSOLE,
log.InfoLevel,
log.Fields{"Total power": fmt.Sprintf("%f %d", clusterPower, clusterPowerHist.Len()),
"Sec Avg": fmt.Sprintf("%f", clusterMean)},
"")
if clusterMean > hiThreshold {
elekLog.ElektronLog.Log(elekLogTypes.GENERAL,
elekLog.ElektronLog.Log(elekLogTypes.CONSOLE,
log.InfoLevel,
log.Fields{}, "Need to cap a node")
// Create statics for all victims and choose one to cap
@ -163,12 +163,12 @@ func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThresh
if !cappedHosts[victim.Host] {
cappedHosts[victim.Host] = true
orderCapped = append(orderCapped, victim.Host)
elekLog.ElektronLog.Log(elekLogTypes.GENERAL,
elekLog.ElektronLog.Log(elekLogTypes.CONSOLE,
log.InfoLevel,
log.Fields{"Capping Victim": fmt.Sprintf("%s", victim.Host),
"Avg. Wattage": fmt.Sprintf("%f", victim.Watts*pcp.RAPLUnits)}, "")
if err := rapl.Cap(victim.Host, "rapl", 50); err != nil {
elekLog.ElektronLog.Log(elekLogTypes.ERROR,
elekLog.ElektronLog.Log(elekLogTypes.CONSOLE,
log.ErrorLevel,
log.Fields{}, "Error capping host")
}
@ -184,11 +184,11 @@ func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThresh
cappedHosts[host] = false
// User RAPL package to send uncap.
log.Printf("Uncapping host %s", host)
elekLog.ElektronLog.Log(elekLogTypes.GENERAL,
elekLog.ElektronLog.Log(elekLogTypes.CONSOLE,
log.InfoLevel,
log.Fields{"Uncapped host": host}, "")
if err := rapl.Cap(host, "rapl", 100); err != nil {
elekLog.ElektronLog.Log(elekLogTypes.ERROR,
elekLog.ElektronLog.Log(elekLogTypes.CONSOLE,
log.ErrorLevel,
log.Fields{}, "Error capping host")
}
@ -200,7 +200,7 @@ func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThresh
}
}(logging, hiThreshold, loThreshold)
elekLog.ElektronLog.Log(elekLogTypes.GENERAL,
elekLog.ElektronLog.Log(elekLogTypes.CONSOLE,
log.InfoLevel,
log.Fields{}, "PCP logging started")
@ -212,7 +212,7 @@ func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThresh
select {
case <-quit:
elekLog.ElektronLog.Log(elekLogTypes.GENERAL,
elekLog.ElektronLog.Log(elekLogTypes.CONSOLE,
log.InfoLevel,
log.Fields{}, "Stopping PCP logging in 5 seconds")
time.Sleep(5 * time.Second)