mirror of
https://github.com/ansible/awx.git
synced 2026-03-15 16:07:30 -02:30
Handle the situation where we could not communiate with celery
This commit is contained in:
@@ -145,13 +145,17 @@ def rebuild_graph(message):
|
|||||||
inspector = inspect()
|
inspector = inspect()
|
||||||
active_task_queues = inspector.active()
|
active_task_queues = inspector.active()
|
||||||
active_tasks = []
|
active_tasks = []
|
||||||
for queue in active_task_queues:
|
if active_task_queues is not None:
|
||||||
active_tasks += [at['id'] for at in active_task_queues[queue]]
|
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()
|
all_sorted_tasks = get_tasks()
|
||||||
if not len(all_sorted_tasks):
|
if not len(all_sorted_tasks):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
running_tasks = filter(lambda t: t.status == 'running', all_sorted_tasks)
|
running_tasks = filter(lambda t: t.status == 'running', all_sorted_tasks)
|
||||||
waiting_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)
|
new_tasks = filter(lambda t: t.status == 'new', all_sorted_tasks)
|
||||||
|
|||||||
Reference in New Issue
Block a user