Code and formatting fixes

Changed the shorthand for log config flag.
Fixed formatting as mentioned.
Removed unnecessary function declarations from elektronLogger interface.
Disabled schedWindow and clsfnTaskDistrOverhead in config file.
This commit is contained in:
balandi1 2019-12-09 10:55:34 -05:00
parent 02abb1e882
commit 027adef642
5 changed files with 6 additions and 11 deletions

View file

@ -16,11 +16,11 @@ pcp:
filenameExtension: .pcplog
allowOnConsole: false
schedWindow:
enabled: true
enabled: false
filenameExtension: _schedWindow.log
allowOnConsole: true
clsfnTaskDistrOverhead:
enabled: true
enabled: false
filenameExtension: _classificationOverhead.log
allowOnConsole: true

View file

@ -1,11 +1,11 @@
package logging
import (
"fmt"
log "github.com/sirupsen/logrus"
"os"
"path/filepath"
"strings"
log "github.com/sirupsen/logrus"
)
type consoleLogger struct {
@ -88,7 +88,6 @@ func (cLog *consoleLogger) createLogFile(prefix string) {
if cLog.isEnabled() {
filename := strings.Join([]string{prefix, cLog.getFilenameExtension()}, "")
dirName := cLog.logDir.getDirName()
fmt.Println(dirName)
if dirName != "" {
if logFile, err := os.Create(filepath.Join(dirName, filename)); err != nil {
log.Fatal("Unable to create logFile: ", err)

View file

@ -16,9 +16,6 @@ var elektronLoggerInstance elektronLogger
type elektronLogger interface {
setNext(next elektronLogger)
isEnabled() bool
isAllowedOnConsole() bool
getFilenameExtension() string
Log(logType int, level log.Level, message string)
Logf(logType int, level log.Level, msgFmtString string, args ...interface{})
WithFields(logData log.Fields) elektronLogger

View file

@ -78,7 +78,7 @@ func init() {
flag.BoolVar(fixSchedWindow, "fixSw", false, "Fix the size of the scheduling window that every deployed scheduling policy should schedule, provided switching is enabled (shorthand).")
flag.IntVar(schedWindowSize, "swSize", 200, "Size of the scheduling window if fixSchedWindow is set (shorthand).")
flag.StringVar(schedPolSwitchCriteria, "spsCriteria", "taskDist", "Scheduling policy switching criteria (shorthand).")
flag.StringVar(logConfigFilename, "lgConfigName", "logConfig.yaml", "Log Configuration file name (shorthand).")
flag.StringVar(logConfigFilename, "lgCfg", "logConfig.yaml", "Log Configuration file name (shorthand).")
}
func listAllSchedulingPolicies() {

View file

@ -79,8 +79,7 @@ func (s *fillNextOfferCycle) apply(taskQueue []def.Task) (int, int) {
numberOfTasksTraversed++
for i := *task.Instances; i > 0; i-- {
elekLog.Logf(CONSOLE, log.InfoLevel,
"Checking if Instance #%d of Task[%s] can be scheduled "+
"during the next offer cycle...", i, task.Name)
"Checking if Instance #%d of Task[%s] can be scheduled "+"during the next offer cycle...", i, task.Name)
if canSchedule(task) {
filledCPU += task.CPU
filledRAM += task.RAM