mirror of
https://github.com/valitydev/salt.git
synced 2024-11-09 01:36:48 +00:00
fixing merge conflict
This commit is contained in:
parent
3d2d8c986f
commit
3c2f5d3396
@ -953,7 +953,7 @@ class Schedule(object):
|
|||||||
|
|
||||||
if when < now - self.opts['loop_interval'] and \
|
if when < now - self.opts['loop_interval'] and \
|
||||||
not data.get('_run', False) and \
|
not data.get('_run', False) and \
|
||||||
not run and \
|
not data.get('run', False) and \
|
||||||
not data['_splay']:
|
not data['_splay']:
|
||||||
data['_next_fire_time'] = None
|
data['_next_fire_time'] = None
|
||||||
data['_continue'] = True
|
data['_continue'] = True
|
||||||
@ -1183,9 +1183,15 @@ class Schedule(object):
|
|||||||
'skip_function',
|
'skip_function',
|
||||||
'skip_during_range']
|
'skip_during_range']
|
||||||
for job, data in six.iteritems(schedule):
|
for job, data in six.iteritems(schedule):
|
||||||
|
# Clear these out between runs
|
||||||
|
for item in ['_continue',
|
||||||
|
'_error',
|
||||||
|
'_skip_reason']:
|
||||||
|
if item in data:
|
||||||
|
del data[item]
|
||||||
run = False
|
run = False
|
||||||
|
|
||||||
if job in _hidden and not data:
|
if job in _hidden:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not isinstance(data, dict):
|
if not isinstance(data, dict):
|
||||||
@ -1298,6 +1304,7 @@ class Schedule(object):
|
|||||||
|
|
||||||
# An error occurred so we bail out
|
# An error occurred so we bail out
|
||||||
if '_error' in data and data['_error']:
|
if '_error' in data and data['_error']:
|
||||||
|
log.debug('Sommething went wrong')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
seconds = data['_next_fire_time'] - now
|
seconds = data['_next_fire_time'] - now
|
||||||
@ -1403,22 +1410,6 @@ class Schedule(object):
|
|||||||
miss_msg = ' (runtime missed ' \
|
miss_msg = ' (runtime missed ' \
|
||||||
'by {0} seconds)'.format(abs(seconds))
|
'by {0} seconds)'.format(abs(seconds))
|
||||||
|
|
||||||
if 'jid_include' not in data or data['jid_include']:
|
|
||||||
data['jid_include'] = True
|
|
||||||
log.debug('schedule: This job was scheduled with jid_include, '
|
|
||||||
'adding to cache (jid_include defaults to True)')
|
|
||||||
if 'maxrunning' in data:
|
|
||||||
log.debug(
|
|
||||||
'schedule: This job was scheduled with a max number '
|
|
||||||
'of %s', data['maxrunning']
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
log.info(
|
|
||||||
'schedule: maxrunning parameter was not specified '
|
|
||||||
'for job %s, defaulting to 1.', job
|
|
||||||
)
|
|
||||||
data['maxrunning'] = 1
|
|
||||||
|
|
||||||
multiprocessing_enabled = self.opts.get('multiprocessing', True)
|
multiprocessing_enabled = self.opts.get('multiprocessing', True)
|
||||||
|
|
||||||
if salt.utils.platform.is_windows():
|
if salt.utils.platform.is_windows():
|
||||||
@ -1430,10 +1421,20 @@ class Schedule(object):
|
|||||||
returners = self.returners
|
returners = self.returners
|
||||||
self.returners = {}
|
self.returners = {}
|
||||||
try:
|
try:
|
||||||
if not run:
|
if run:
|
||||||
log.info('Not running scheduled job: {0}'.format(job))
|
if 'jid_include' not in data or data['jid_include']:
|
||||||
else:
|
data['jid_include'] = True
|
||||||
log.info('Running scheduled job: {0}{1}'.format(job, miss_msg))
|
log.debug('schedule: This job was scheduled with jid_include, '
|
||||||
|
'adding to cache (jid_include defaults to True)')
|
||||||
|
if 'maxrunning' in data:
|
||||||
|
log.debug('schedule: This job was scheduled with a max '
|
||||||
|
'number of %s', data['maxrunning'])
|
||||||
|
else:
|
||||||
|
log.info('schedule: maxrunning parameter was not specified for '
|
||||||
|
'job %s, defaulting to 1.', job)
|
||||||
|
data['maxrunning'] = 1
|
||||||
|
|
||||||
|
log.info('Running scheduled job: %s%s', job, miss_msg)
|
||||||
|
|
||||||
if multiprocessing_enabled:
|
if multiprocessing_enabled:
|
||||||
thread_cls = salt.utils.process.SignalHandlingMultiprocessingProcess
|
thread_cls = salt.utils.process.SignalHandlingMultiprocessingProcess
|
||||||
@ -1452,12 +1453,13 @@ class Schedule(object):
|
|||||||
if multiprocessing_enabled:
|
if multiprocessing_enabled:
|
||||||
proc.join()
|
proc.join()
|
||||||
finally:
|
finally:
|
||||||
if '_seconds' in data:
|
|
||||||
data['_next_fire_time'] = now + data['_seconds']
|
|
||||||
# Only set _last_run if the job ran
|
# Only set _last_run if the job ran
|
||||||
if run:
|
if run:
|
||||||
data['_last_run'] = now
|
data['_last_run'] = now
|
||||||
data['_splay'] = None
|
if '_seconds' in data:
|
||||||
|
data['_next_fire_time'] = now + data['_seconds']
|
||||||
|
data['_splay'] = None
|
||||||
|
|
||||||
if salt.utils.platform.is_windows():
|
if salt.utils.platform.is_windows():
|
||||||
# Restore our function references.
|
# Restore our function references.
|
||||||
self.functions = functions
|
self.functions = functions
|
||||||
|
@ -326,15 +326,16 @@ class SchedulerEvalTest(ModuleCase, SaltReturnAssertsMixin):
|
|||||||
verify that scheduled job does not run
|
verify that scheduled job does not run
|
||||||
and returns the right error
|
and returns the right error
|
||||||
'''
|
'''
|
||||||
|
run_time = int(time.mktime(dateutil_parser.parse('11/29/2017 4:00pm').timetuple()))
|
||||||
|
|
||||||
job = {
|
job = {
|
||||||
'schedule': {
|
'schedule': {
|
||||||
'job1': {
|
'job1': {
|
||||||
'function': 'test.ping',
|
'function': 'test.ping',
|
||||||
'when': '11/29/2017 13:00pm',
|
'when': '13/29/2017 1:00pm',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
run_time = int(time.mktime(dateutil_parser.parse('11/29/2017 4:00pm').timetuple()))
|
|
||||||
|
|
||||||
# Add the job to the scheduler
|
# Add the job to the scheduler
|
||||||
self.schedule.opts.update(job)
|
self.schedule.opts.update(job)
|
||||||
|
@ -110,12 +110,14 @@ class SchedulerSkipTest(ModuleCase, SaltReturnAssertsMixin):
|
|||||||
'''
|
'''
|
||||||
verify that scheduled job is not not and returns the right error string
|
verify that scheduled job is not not and returns the right error string
|
||||||
'''
|
'''
|
||||||
|
run_time = int(time.mktime(dateutil_parser.parse('11/29/2017 2:30pm').timetuple()))
|
||||||
|
|
||||||
job1 = {
|
job1 = {
|
||||||
'schedule': {
|
'schedule': {
|
||||||
'job1': {
|
'job1': {
|
||||||
'function': 'test.ping',
|
'function': 'test.ping',
|
||||||
'hours': '1',
|
'hours': '1',
|
||||||
'_next_fire_time': 1511994600,
|
'_next_fire_time': run_time,
|
||||||
'skip_during_range': {
|
'skip_during_range': {
|
||||||
'start': '25pm',
|
'start': '25pm',
|
||||||
'end': '3pm'
|
'end': '3pm'
|
||||||
@ -129,7 +131,7 @@ class SchedulerSkipTest(ModuleCase, SaltReturnAssertsMixin):
|
|||||||
'job2': {
|
'job2': {
|
||||||
'function': 'test.ping',
|
'function': 'test.ping',
|
||||||
'hours': '1',
|
'hours': '1',
|
||||||
'_next_fire_time': 1511994600,
|
'_next_fire_time': run_time,
|
||||||
'skip_during_range': {
|
'skip_during_range': {
|
||||||
'start': '2pm',
|
'start': '2pm',
|
||||||
'end': '25pm'
|
'end': '25pm'
|
||||||
@ -138,8 +140,6 @@ class SchedulerSkipTest(ModuleCase, SaltReturnAssertsMixin):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
run_time = int(time.mktime(dateutil_parser.parse('11/29/2017 2:30pm').timetuple()))
|
|
||||||
|
|
||||||
# Add job1 to schedule
|
# Add job1 to schedule
|
||||||
self.schedule.opts.update(job1)
|
self.schedule.opts.update(job1)
|
||||||
|
|
||||||
@ -151,6 +151,7 @@ class SchedulerSkipTest(ModuleCase, SaltReturnAssertsMixin):
|
|||||||
_expected = ('Invalid date string for start in ',
|
_expected = ('Invalid date string for start in ',
|
||||||
'skip_during_range. Ignoring ',
|
'skip_during_range. Ignoring ',
|
||||||
'job %s.', 'job1')
|
'job %s.', 'job1')
|
||||||
|
log.debug('=== ret %s ===', ret)
|
||||||
self.assertEqual(ret['_error'], _expected)
|
self.assertEqual(ret['_error'], _expected)
|
||||||
|
|
||||||
# Clear out schedule
|
# Clear out schedule
|
||||||
|
Loading…
Reference in New Issue
Block a user