Add scheduler to the master using runners instead of functions

This commit is contained in:
Thomas S Hatch 2013-01-14 01:30:53 -07:00
parent 7b1d9d9330
commit 0fb12227d2

View File

@ -167,6 +167,8 @@ class Master(SMaster):
search = salt.search.Search(self.opts)
last = time.time()
fileserver = salt.fileserver.Fileserver(self.opts)
runners = salt.loader.runner(self.opts)
schedule = salt.utils.schedule.Schedule(self.opts, runners)
while True:
if self.opts['keep_jobs'] != 0:
cur = '{0:%Y%m%d%H}'.format(datetime.datetime.now())
@ -195,6 +197,12 @@ class Master(SMaster):
log.error(
'Exception {0} occured in file server update'.format(exc)
)
try:
schedule.eval()
except Exception as exc:
log.error(
'Exception {0} occured in scheduled job'.format(exc)
)
try:
time.sleep(int(self.opts['loop_interval']))
except KeyboardInterrupt: