added jobInfo Maximum storage
This commit is contained in:
parent
a977ea2c07
commit
7a9bd06edf
1 changed files with 12 additions and 2 deletions
|
|
@ -45,6 +45,10 @@ class Job:
|
||||||
self.hostgroup = hostgroup
|
self.hostgroup = hostgroup
|
||||||
#TODO: limit the size of this list; else it is a memory leak
|
#TODO: limit the size of this list; else it is a memory leak
|
||||||
self.jobInfos = []
|
self.jobInfos = []
|
||||||
|
self.jobIndex = 0
|
||||||
|
self.jobInfoSize = 10
|
||||||
|
for i in range(self.jobInfoSize):
|
||||||
|
self.jobInfos.append(None)
|
||||||
self.jobThreshold = 0
|
self.jobThreshold = 0
|
||||||
self._enabled = True
|
self._enabled = True
|
||||||
|
|
||||||
|
|
@ -70,6 +74,13 @@ class Job:
|
||||||
def set_enabled(self, enabled=True):
|
def set_enabled(self, enabled=True):
|
||||||
self._enabled = enabled
|
self._enabled = enabled
|
||||||
|
|
||||||
|
def add_job_Info(self, jobInfo):
|
||||||
|
self.jobIndex += 1
|
||||||
|
if self.jobIndex > self.jobInfoSize:
|
||||||
|
self.jobIndex = 0
|
||||||
|
self.jobInfos[self.jobIndex] = jobInfo
|
||||||
|
|
||||||
|
|
||||||
def handle_threshold(self, jobInfo, serviceThreshold, executionSucessful):
|
def handle_threshold(self, jobInfo, serviceThreshold, executionSucessful):
|
||||||
if executionSucessful:
|
if executionSucessful:
|
||||||
if self.jobThreshold > 0:
|
if self.jobThreshold > 0:
|
||||||
|
|
@ -106,8 +117,7 @@ class Job:
|
||||||
self.handle_threshold(jobInfo, self.service.get_threshold(), jobInfo.was_execution_successful())
|
self.handle_threshold(jobInfo, self.service.get_threshold(), jobInfo.was_execution_successful())
|
||||||
|
|
||||||
logger.info("Code: " + str(jobInfo.get_errorcode()) + ", Message: " + str(jobInfo.get_message()))
|
logger.info("Code: " + str(jobInfo.get_errorcode()) + ", Message: " + str(jobInfo.get_message()))
|
||||||
|
self.add_job_Info(jobInfo)
|
||||||
self.jobInfos.append(jobInfo)
|
|
||||||
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
logger.debug(e)
|
logger.debug(e)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue