From 052e73d3b3133524e0c661b12556ae53626eb195 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 14 Sep 2016 14:12:42 -0500 Subject: Add daily failure notifications --- jobs/JobBase.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'jobs/JobBase.py') diff --git a/jobs/JobBase.py b/jobs/JobBase.py index 9ea31a4..cf720fe 100755 --- a/jobs/JobBase.py +++ b/jobs/JobBase.py @@ -19,6 +19,7 @@ class JobFailureNotificationFrequency: EVERYFIVEMINUTES = "5min" EVERYTENMINUTES = "10min" EVERYHOUR = "hour" + EVERYDAY = "day" ONSTATECHANGE = "state_change" class JobBase(object): @@ -66,6 +67,12 @@ class JobBase(object): if datetime.timedelta(seconds=(now - lastNotify)) > datetime.timedelta(minutes=59, seconds=0): return True return False + elif notifyFrequency == JobFailureNotificationFrequency.EVERYDAY: + now = time.time() + lastNotify = jobState.LastNotifyTime + if datetime.timedelta(seconds=(now - lastNotify)) > datetime.timedelta(hours=24, minutes=0, seconds=0): + return True + return False elif notifyFrequency == JobFailureNotificationFrequency.ONSTATECHANGE: #Only notify if the last JobState was a Success return jobState.CurrentStateSuccess -- cgit v1.2.3