From 3c82085b93cb9adf436f5aaa0e05efd9f0d9ca94 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Wed, 12 Mar 2014 16:11:56 -0400 Subject: [PATCH] Handle the situation where we could not communiate with celery --- awx/main/management/commands/run_task_system.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/awx/main/management/commands/run_task_system.py b/awx/main/management/commands/run_task_system.py index f33504f623..dd97f4e144 100644 --- a/awx/main/management/commands/run_task_system.py +++ b/awx/main/management/commands/run_task_system.py @@ -145,13 +145,17 @@ def rebuild_graph(message): inspector = inspect() active_task_queues = inspector.active() active_tasks = [] - for queue in active_task_queues: - active_tasks += [at['id'] for at in active_task_queues[queue]] - + if active_task_queues is not None: + for queue in active_task_queues: + active_tasks += [at['id'] for at in active_task_queues[queue]] + else: + if settings.DEBUG: + print("Could not communicate with celery!") + # TODO: Something needs to be done here to signal to the system as a whole that celery appears to be down + return None all_sorted_tasks = get_tasks() if not len(all_sorted_tasks): return None - running_tasks = filter(lambda t: t.status == 'running', all_sorted_tasks) waiting_tasks = filter(lambda t: t.status != 'running', all_sorted_tasks) new_tasks = filter(lambda t: t.status == 'new', all_sorted_tasks)