mirror of
https://github.com/ansible/awx.git
synced 2026-05-14 21:07:39 -02:30
Query database running tasks after querying celery to prevent race
condition that could cause us to think the task was orphaned
This commit is contained in:
@@ -142,9 +142,6 @@ def get_tasks():
|
|||||||
def rebuild_graph(message):
|
def rebuild_graph(message):
|
||||||
''' Regenerate the task graph by refreshing known tasks from Tower, purging orphaned running tasks,
|
''' Regenerate the task graph by refreshing known tasks from Tower, purging orphaned running tasks,
|
||||||
and creatingdependencies for new tasks before generating directed edge relationships between those tasks '''
|
and creatingdependencies for new tasks before generating directed edge relationships between those tasks '''
|
||||||
all_sorted_tasks = get_tasks()
|
|
||||||
if not len(all_sorted_tasks):
|
|
||||||
return None
|
|
||||||
|
|
||||||
inspector = inspect()
|
inspector = inspect()
|
||||||
if not hasattr(settings, 'IGNORE_CELERY_INSPECTOR'):
|
if not hasattr(settings, 'IGNORE_CELERY_INSPECTOR'):
|
||||||
@@ -153,6 +150,10 @@ def rebuild_graph(message):
|
|||||||
print("Ignoring celery task inspector")
|
print("Ignoring celery task inspector")
|
||||||
active_task_queues = None
|
active_task_queues = None
|
||||||
|
|
||||||
|
all_sorted_tasks = get_tasks()
|
||||||
|
if not len(all_sorted_tasks):
|
||||||
|
return None
|
||||||
|
|
||||||
active_tasks = []
|
active_tasks = []
|
||||||
if active_task_queues is not None:
|
if active_task_queues is not None:
|
||||||
for queue in active_task_queues:
|
for queue in active_task_queues:
|
||||||
|
|||||||
Reference in New Issue
Block a user