aboutsummaryrefslogtreecommitdiff
path: root/jobs
diff options
context:
space:
mode:
Diffstat (limited to 'jobs')
-rwxr-xr-xjobs/JobBase.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/jobs/JobBase.py b/jobs/JobBase.py
index d7ec2a1..1882443 100755
--- a/jobs/JobBase.py
+++ b/jobs/JobBase.py
@@ -23,8 +23,8 @@ class JobFailureNotificationFrequency:
ONSTATECHANGE = "state_change"
class JobFailureCountMinimumBeforeNotification:
- ONE = "one"
- TWO = "two"
+ ONE = 1
+ TWO = 2
class JobBase(object):
def __init__(self, config, *args):
@@ -48,16 +48,16 @@ class JobBase(object):
return True
return False
- """Returns True if the jobmanager should call 'onFailure' to alert the admin"""
+ """Returns True if the jobmanager should call 'onFailure' to alert the admin after a job failed"""
def shouldNotifyFailure(self, jobState):
notifyFrequency = self.notifyOnFailureEvery()
minFailureCount = self.numberFailuresBeforeNotification()
+ currentFailureCount = jobState.NumFailures
- if minFailureCount == JobFailureCountMinimumBeforeNotification.ONE:
- pass
- elif minFailureCount == JobFailureCountMinimumBeforeNotification.TWO:
- if jobState.CurrentStateSuccess:
- return False
+ if 1 + currentFailureCount >= minFailureCount:
+ pass #keep evaluating
+ else:
+ return False #Do not notify
if notifyFrequency == JobFailureNotificationFrequency.EVERYTIME:
return True