added hostgroup to Job
This commit is contained in:
parent
14ad51741e
commit
131ce1a75b
2 changed files with 8 additions and 6 deletions
|
|
@ -114,7 +114,7 @@ def main():
|
||||||
for service in hostgroup.get_services():
|
for service in hostgroup.get_services():
|
||||||
for host in hostgroup.get_hosts():
|
for host in hostgroup.get_hosts():
|
||||||
for period in service.get_periods():
|
for period in service.get_periods():
|
||||||
job = Job(service, host, hostgroup.get_members(), hostgroup.get_processors(), core)
|
job = Job(service, host, hostgroup.get_members(), hostgroup.get_processors(), core, hostgroup)
|
||||||
schedulerJob = period.createJob(scheduler, job, handleJob)
|
schedulerJob = period.createJob(scheduler, job, handleJob)
|
||||||
if schedulerJob is not None:
|
if schedulerJob is not None:
|
||||||
job.set_job(schedulerJob)
|
job.set_job(schedulerJob)
|
||||||
|
|
|
||||||
|
|
@ -32,21 +32,21 @@ def generateId():
|
||||||
|
|
||||||
|
|
||||||
class Job:
|
class Job:
|
||||||
def __init__(self, service, host, members, processors, core):
|
def __init__(self, service, host, members, processors, core, hostgroup):
|
||||||
self.service = service
|
self.service = service
|
||||||
self.host = host
|
self.host = host
|
||||||
self.members = members
|
self.members = members
|
||||||
self.processors = processors
|
self.processors = processors
|
||||||
self.core = core
|
self.core = core
|
||||||
|
self.hostgroup = hostgroup
|
||||||
self.jobInfos = []
|
self.jobInfos = []
|
||||||
self.jobThreshold = 0
|
self.jobThreshold = 0
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.__dict__)
|
return str(self.__dict__)
|
||||||
|
|
||||||
|
|
||||||
def __hex__(self):
|
def __hex__(self):
|
||||||
return hex(crc32(str(self.service) + str(self.host) + str(self.members)))
|
return hex(crc32(str(self.hostgroup) + str(self.host) + str(self.service) + str(self.members)))
|
||||||
|
|
||||||
def hex_string(self):
|
def hex_string(self):
|
||||||
ret = self.__hex__()
|
ret = self.__hex__()
|
||||||
|
|
@ -62,7 +62,9 @@ class Job:
|
||||||
self.log = log
|
self.log = log
|
||||||
|
|
||||||
def pretty_string(self):
|
def pretty_string(self):
|
||||||
return self.hex_string() + ": (" + str(self.host) + str(self.service) + str(self.job) + ")"
|
ret = (self.hex_string() + ": (Hostgroup: " + str(self.hostgroup.get_name()) +
|
||||||
|
" Host: " + str(self.host) + " Service: " + str(self.service) + str(self.job) + ")")
|
||||||
|
return ret
|
||||||
|
|
||||||
def set_job(self, job):
|
def set_job(self, job):
|
||||||
self.job = job
|
self.job = job
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue