aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ritter <tom@ritter.vg>2016-02-02 11:30:02 -0500
committerTom Ritter <tom@ritter.vg>2016-02-02 11:30:02 -0500
commit1e09fc3a5b44a2130f8d1b24967a39ff20ea999a (patch)
tree3cb672d593354b3c13e9ada2a99ba4bdfa08d207
parent2fe68bac48427e687888fb8de13eea541d531610 (diff)
Add in the friendly name to the state file for debugging
-rwxr-xr-xjobmanager.py2
-rwxr-xr-xjobs/PeerChecker.py2
-rw-r--r--jobstate.py13
3 files changed, 11 insertions, 6 deletions
diff --git a/jobmanager.py b/jobmanager.py
index 9519379..e067a99 100755
--- a/jobmanager.py
+++ b/jobmanager.py
@@ -49,7 +49,7 @@ class JobManager:
except:
logging.warn("No state was found for " + thisJob.getStateName() + \
", making up a dummy state for it.")
- lastRunStatus = self.state[thisJob.getStateName()] = JobState.Empty(thisJob.getStateName())
+ lastRunStatus = self.state[thisJob.getStateName()] = JobState.Empty(thisJob.getStateName(), thisJob.getName())
if not thisJob.execute():
#Unsuccessful run
diff --git a/jobs/PeerChecker.py b/jobs/PeerChecker.py
index 8d0a6b7..1214b0f 100755
--- a/jobs/PeerChecker.py
+++ b/jobs/PeerChecker.py
@@ -17,6 +17,8 @@ class PeerChecker(JobSpawner.JobSpawner):
self.notificationAddress = notificationAddress
super(PeerChecker.IndividualPeerChecker, self).__init__(config, checkurl, notificationAddress)
+ def getName(self):
+ return str(self.__class__) + " for " + self.checkurl
def executeEvery(self):
return JobBase.JobFrequency.HOUR
def notifyOnFailureEvery(self):
diff --git a/jobstate.py b/jobstate.py
index ba5e205..ba4113f 100644
--- a/jobstate.py
+++ b/jobstate.py
@@ -5,8 +5,9 @@ import logging
import datetime
class JobState:
- def __init__(self, name):
+ def __init__(self, name, friendlyname):
self.name = name
+ self.friendlyname = friendlyname
self.CurrentStateSuccess = True
self.FirstFailureTime = 0
self.LastNotifyTime = 0
@@ -40,12 +41,13 @@ class JobState:
ret = self.name + "|"
ret += "Succeeding" if self.CurrentStateSuccess else "Failing"
ret += "|" + str(self.FirstFailureTime)
- ret += "|" + str(self.LastNotifyTime) + "\n"
+ ret += "|" + str(self.LastNotifyTime) + "|"
+ ret += self.friendlyname + "\n"
return ret
@staticmethod
def Parse(line):
- s = JobState("")
+ s = JobState("", "")
line = line.strip()
parts = line.split("|")
@@ -54,10 +56,11 @@ class JobState:
s.CurrentStateSuccess = True if parts[1] == "Succeeding" else False
s.FirstFailureTime = float(parts[2])
s.LastNotifyTime = float(parts[3])
+ s.friendlyname = parts[4]
return s
@staticmethod
- def Empty(name):
- s = JobState(name)
+ def Empty(name, friendlyname):
+ s = JobState(name, friendlyname)
return s