diff --git a/awx/main/management/commands/run_task_system.py b/awx/main/management/commands/run_task_system.py index 0f83a7aabd..34f4cf4f8d 100644 --- a/awx/main/management/commands/run_task_system.py +++ b/awx/main/management/commands/run_task_system.py @@ -198,9 +198,9 @@ def rebuild_graph(message): # NOTE: Pull status again and make sure it didn't finish in # the meantime? task.status = 'failed' - task.job_explanation += ''.join(( + task.job_explanation += ' '.join(( 'Task was marked as running in Tower but was not present in', - 'Celery so it has been marked as failed', + 'Celery, so it has been marked as failed.', )) task.save() task.socketio_emit_status("failed") diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 572237c164..09ad0f29d5 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -39,7 +39,7 @@ from django.utils.timezone import now # AWX from awx.main.constants import CLOUD_PROVIDERS from awx.main.models import * # Job, JobEvent, ProjectUpdate, InventoryUpdate, - # Schedule, UnifiedJobTemplate + # Schedule, UnifiedJobTemplate, Instance from awx.main.queue import FifoQueue from awx.main.utils import (get_ansible_version, decrypt_field, update_scm_url, ignore_inventory_computed_fields, emit_websocket_notification, @@ -87,6 +87,12 @@ def tower_periodic_scheduler(self): return logger.debug("Last run was: %s", last_run) write_last_run(run_now) + + # Sanity check: If this is a secondary machine, there is nothing + # on the schedule. + if Instance.objects.my_role() == 'secondary': + return + old_schedules = Schedule.objects.enabled().before(last_run) for schedule in old_schedules: schedule.save()