diff options
author | Tom Ritter <tom@ritter.vg> | 2016-01-31 14:37:22 -0500 |
---|---|---|
committer | Tom Ritter <tom@ritter.vg> | 2016-01-31 14:37:22 -0500 |
commit | 618c3606a1f5f230124a937201e53589dbab1260 (patch) | |
tree | 8eed5b8222409e7f91de99e525c8eeea3a19b953 | |
parent | 3bea3bae59e7404b286b5bf97a6270270bfadd6c (diff) |
Correcting a few small errors
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | jobmanager.py | 2 | ||||
-rwxr-xr-x | jobs/JobSpawner.py | 4 | ||||
-rwxr-xr-x | jobs/PeerChecker.py | 4 | ||||
-rw-r--r-- | jobstate.py | 8 |
5 files changed, 11 insertions, 8 deletions
@@ -1,2 +1,3 @@ *.pyc settings.cfg +jobrunhistory.db
\ No newline at end of file diff --git a/jobmanager.py b/jobmanager.py index fa55883..a53a84e 100755 --- a/jobmanager.py +++ b/jobmanager.py @@ -47,7 +47,7 @@ class JobManager: lastRunStatus = self.state[thisJob.getStateName()] except: logging.warn("No state was found for " + thisJob.getStateName() + \ - "\nMaking up a dummy state for it.") + ", making up a dummy state for it.") lastRunStatus = self.state[thisJob.getStateName()] = JobState.Empty(thisJob.getStateName()) logging.info("Executing " + thisJob.getName()) diff --git a/jobs/JobSpawner.py b/jobs/JobSpawner.py index 50f3043..0765339 100755 --- a/jobs/JobSpawner.py +++ b/jobs/JobSpawner.py @@ -1,7 +1,7 @@ #!/usr/bin/env python
class JobSpawner:
- """OVERRIDE ME
- Returns an array (or using 'yield') of Job objects to run"""
+ """OVERRIDE ME
+ Returns an array (or using 'yield') of Job objects to run"""
def get_sub_jobs(self, config):
pass
diff --git a/jobs/PeerChecker.py b/jobs/PeerChecker.py index 8211472..12ce8d8 100755 --- a/jobs/PeerChecker.py +++ b/jobs/PeerChecker.py @@ -8,6 +8,7 @@ import imaplib import requests
import JobBase
+import JobSpawner
class PeerChecker(JobSpawner.JobSpawner):
class IndividualPeerChecker(JobBase.JobBase):
@@ -51,8 +52,7 @@ class PeerChecker(JobSpawner.JobSpawner): self.subject = self.checkurl + " is not responding."
self.body = str(e)
return peerOK
-
- return peerOK:
+
def onFailure(self):
return self.sendEmail(self.subject, self.body, self.notificationAddress)
def onStateChangeSuccess(self):
diff --git a/jobstate.py b/jobstate.py index 4df0de0..ba5e205 100644 --- a/jobstate.py +++ b/jobstate.py @@ -8,6 +8,8 @@ class JobState: def __init__(self, name): self.name = name self.CurrentStateSuccess = True + self.FirstFailureTime = 0 + self.LastNotifyTime = 0 def markFailedAndNotify(self): if self.CurrentStateSuccess: @@ -38,12 +40,12 @@ class JobState: ret = self.name + "|" ret += "Succeeding" if self.CurrentStateSuccess else "Failing" ret += "|" + str(self.FirstFailureTime) - ret += "|" + str(self.LastNotifyTime) + ret += "|" + str(self.LastNotifyTime) + "\n" return ret @staticmethod def Parse(line): - s = JobState() + s = JobState("") line = line.strip() parts = line.split("|") @@ -58,4 +60,4 @@ class JobState: @staticmethod def Empty(name): s = JobState(name) - return s
\ No newline at end of file + return s |