diff options
author | Tom <tom@ritter.vg> | 2016-09-14 14:12:42 -0500 |
---|---|---|
committer | Tom <tom@ritter.vg> | 2016-09-14 14:12:42 -0500 |
commit | 052e73d3b3133524e0c661b12556ae53626eb195 (patch) | |
tree | 2116caa63dff9ed2ed80d683fe6971be160ea9b7 | |
parent | 148cb0c5ab5e1eb94091e18110fbaad7c572660c (diff) |
Add daily failure notifications
-rwxr-xr-x | jobs/JobBase.py | 7 |
1 files changed, 7 insertions, 0 deletions
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 |