improved scheduler logs

This commit is contained in:
Radu Ioan Fericean
2015-09-29 09:36:38 +03:00
parent 8e520dd0c4
commit 52d8cecd12
2 changed files with 6 additions and 10 deletions

View File

@@ -93,7 +93,7 @@ func (at *ActionPlan) GetNextStartTimeOld(now time.Time) (t time.Time) {
var err error
t, err = time.Parse(FORMAT, l)
if err != nil {
Logger.Err(fmt.Sprintf("Cannot parse action timing's StartTime %v", l))
Logger.Err(fmt.Sprintf("Cannot parse action plan's StartTime %v", l))
at.stCache = t
return
}
@@ -258,7 +258,7 @@ func (at *ActionPlan) Execute() (err error) {
return 0, nil
}, 0, accId)
if err != nil {
Logger.Warning(fmt.Sprintf("Error executing action timing: %v", err))
Logger.Warning(fmt.Sprintf("Error executing action plan: %v", err))
}
}
continue // do not go to getActionFunc
@@ -266,7 +266,7 @@ func (at *ActionPlan) Execute() (err error) {
actionFunction, exists := getActionFunc(a.ActionType)
if !exists {
// do not allow the action timing to be rescheduled
// do not allow the action plan to be rescheduled
at.Timing = nil
Logger.Crit(fmt.Sprintf("Function type %v not available, aborting execution!", a.ActionType))
return
@@ -287,7 +287,7 @@ func (at *ActionPlan) Execute() (err error) {
return 0, nil
}, 0, accId)
if err != nil {
Logger.Warning(fmt.Sprintf("Error executing action timing: %v", err))
Logger.Warning(fmt.Sprintf("Error executing action plan: %v", err))
}
}
}
@@ -297,7 +297,8 @@ func (at *ActionPlan) Execute() (err error) {
func (at *ActionPlan) IsASAP() bool {
if at.Timing == nil {
return false
Logger.Warning(fmt.Sprintf("Nil timing on action plan: %+v, executing ASAP!", at))
return true
}
return at.Timing.Timing.StartTime == utils.ASAP
}

View File

@@ -20,7 +20,6 @@ package scheduler
import (
"fmt"
"log"
"sort"
"sync"
"time"
@@ -93,7 +92,6 @@ func (s *Scheduler) LoadActionPlans(storage engine.RatingStorage) {
isAsap := false
newApls := make([]*engine.ActionPlan, 0) // will remove the one time runs from the database
for _, ap := range aps {
log.Printf("AP %+v", ap)
isAsap = ap.IsASAP()
toBeSaved = toBeSaved || isAsap
if isAsap {
@@ -114,9 +112,6 @@ func (s *Scheduler) LoadActionPlans(storage engine.RatingStorage) {
newApls = append(newApls, ap)
}
if toBeSaved {
for _, ap := range newApls {
log.Printf("NewAP: %+v", ap)
}
engine.Guardian.Guard(func() (interface{}, error) {
storage.SetActionPlans(key, newApls)
return 0, nil