just some testing stuff in jobs
This commit is contained in:
parent
cee52e78dc
commit
eae66aa43b
1 changed files with 15 additions and 3 deletions
|
|
@ -108,14 +108,17 @@ class Job:
|
||||||
logger.debug("handle call")
|
logger.debug("handle call")
|
||||||
logger.debug(self.service)
|
logger.debug(self.service)
|
||||||
if self.enabled:
|
if self.enabled:
|
||||||
|
self.job_information.set_execution_start()
|
||||||
|
|
||||||
self.last_execution = None
|
self.last_execution = None
|
||||||
try:
|
try:
|
||||||
self.last_execution = JobExecution(self.get_host())
|
self.last_execution = JobExecution(self.get_host(), self.job_information)
|
||||||
self.service.execute(self.last_execution)
|
self.service.execute(self.last_execution)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
logger.debug(e)
|
logger.debug(e)
|
||||||
|
|
||||||
self.last_execution.set_execution_end()
|
self.job_information.set_execution_end()
|
||||||
|
|
||||||
self.handle_threshold(self.service.get_threshold(), self.last_execution.was_successful())
|
self.handle_threshold(self.service.get_threshold(), self.last_execution.was_successful())
|
||||||
logger.info("Job " + self.get_job_id() +
|
logger.info("Job " + self.get_job_id() +
|
||||||
", Code: " + str(self.last_execution.get_error_code()) +
|
", Code: " + str(self.last_execution.get_error_code()) +
|
||||||
|
|
@ -132,7 +135,7 @@ class Job:
|
||||||
|
|
||||||
|
|
||||||
class JobExecution(object):
|
class JobExecution(object):
|
||||||
def __init__(self, host):
|
def __init__(self, host, job_information):
|
||||||
self.execution_start = datetime.now()
|
self.execution_start = datetime.now()
|
||||||
self.execution_end = -1
|
self.execution_end = -1
|
||||||
self.host = host
|
self.host = host
|
||||||
|
|
@ -181,6 +184,9 @@ class JobInformation(object):
|
||||||
self.service = service
|
self.service = service
|
||||||
self.members = members
|
self.members = members
|
||||||
|
|
||||||
|
self.execution_start = -1
|
||||||
|
self.execution_end = -1
|
||||||
|
|
||||||
self.period = None
|
self.period = None
|
||||||
self.next_run = None
|
self.next_run = None
|
||||||
self.runs = 0
|
self.runs = 0
|
||||||
|
|
@ -199,6 +205,12 @@ class JobInformation(object):
|
||||||
self.last_escalation = None
|
self.last_escalation = None
|
||||||
self.status = "NONE"
|
self.status = "NONE"
|
||||||
|
|
||||||
|
def set_execution_end(self):
|
||||||
|
self.execution_end = datetime.now()
|
||||||
|
|
||||||
|
def set_execution_start(self):
|
||||||
|
self.execution_start = datetime.now()
|
||||||
|
|
||||||
def get_job_overall_fails(self):
|
def get_job_overall_fails(self):
|
||||||
return self.job_overall_fails
|
return self.job_overall_fails
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue