mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Add scheduler to the master using runners instead of functions
This commit is contained in:
parent
7b1d9d9330
commit
0fb12227d2
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user