From 027adef642de044cac5ccf086b905500fb96b325 Mon Sep 17 00:00:00 2001 From: balandi1 Date: Mon, 9 Dec 2019 10:55:34 -0500 Subject: [PATCH] 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. --- logConfig.yaml | 4 ++-- logging/consoleLogger.go | 5 ++--- logging/logger.go | 3 --- scheduler.go | 2 +- utilities/schedUtils/schedUtils.go | 3 +-- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/logConfig.yaml b/logConfig.yaml index 70d5260..c2ba631 100644 --- a/logConfig.yaml +++ b/logConfig.yaml @@ -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 diff --git a/logging/consoleLogger.go b/logging/consoleLogger.go index 2a2f389..3f6fb7a 100644 --- a/logging/consoleLogger.go +++ b/logging/consoleLogger.go @@ -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) diff --git a/logging/logger.go b/logging/logger.go index b0a5bf9..7b4a267 100644 --- a/logging/logger.go +++ b/logging/logger.go @@ -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 diff --git a/scheduler.go b/scheduler.go index 89f77e3..0293835 100644 --- a/scheduler.go +++ b/scheduler.go @@ -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() { diff --git a/utilities/schedUtils/schedUtils.go b/utilities/schedUtils/schedUtils.go index 534651d..97a37b4 100644 --- a/utilities/schedUtils/schedUtils.go +++ b/utilities/schedUtils/schedUtils.go @@ -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