mirror of
https://github.com/ansible/awx.git
synced 2026-05-25 09:37:45 -02:30
Merge pull request #3187 from chrismeyersfsu/fix-schedule_too_damn_fast_devel
fix scheduled jobs race condition Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
@@ -435,6 +435,12 @@ def awx_isolated_heartbeat():
|
||||
|
||||
@task()
|
||||
def awx_periodic_scheduler():
|
||||
with advisory_lock('awx_periodic_scheduler_lock', wait=False) as acquired:
|
||||
if acquired is False:
|
||||
logger.debug("Not running periodic scheduler, another task holds lock")
|
||||
return
|
||||
logger.debug("Starting periodic scheduler")
|
||||
|
||||
run_now = now()
|
||||
state = TowerScheduleState.get_solo()
|
||||
last_run = state.schedule_last_run
|
||||
@@ -462,7 +468,7 @@ def awx_periodic_scheduler():
|
||||
try:
|
||||
job_kwargs = schedule.get_job_kwargs()
|
||||
new_unified_job = schedule.unified_job_template.create_unified_job(**job_kwargs)
|
||||
logger.info('Spawned {} from schedule {}-{}.'.format(
|
||||
logger.info(six.text_type('Spawned {} from schedule {}-{}.').format(
|
||||
new_unified_job.log_format, schedule.name, schedule.pk))
|
||||
|
||||
if invalid_license:
|
||||
|
||||
Reference in New Issue
Block a user