Package linspector :: Package lib :: Package core :: Module job
[hide private]
[frames] | no frames]

Source Code for Module linspector.lib.core.job

 1  """ 
 2  This is what job_function needs as parameter for each job to successfully 
 3  execute. 
 4  """ 
 5   
 6  from command import Command 
 7   
 8   
9 -class JobInfo:
10 - def __init__(self, hostgroupname, members, hosts, service, threshold, parent=None):
11 self.members = members 12 self.hosts = hosts 13 self.service = service 14 self.threshold = threshold 15 self.parent = parent 16 self.name = hostgroupname + "_" + service.name 17 self.jobs = []
18
19 - def __str__(self):
20 return self.name
21
22 - def setLogger(self, log):
23 self.log = log
24
25 - def appendJob(self, job):
26 self.jobs.append(job)
27
28 - def getNextExecutionTime(self):
29 nextExecution = None 30 for job in self.jobs: 31 jobExec = job.trigger.get_next_fire_time() 32 if nextExecution is None or nextExecution > jobExec: 33 nextExecution = jobExec 34 return nextExecution
35
36 - def handleCall(self):
37 print "about to call command " + str(self.service.command)
38 #must find real service command stored in hosts... 39 #but because of error, mentioned in NOTES,ruff, there is no ping i.e. 40 41 #cmd = Command(service.command) 42 #self.log.d("executing command: " + str(command)) 43 #cmd.call() 44 #return cmd 45