mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 15:09:32 -02:30
adjust recursion error text
This commit is contained in:
committed by
Marliana Lara
parent
a3d5705cea
commit
0783d86c6c
@@ -527,7 +527,7 @@ class WorkflowJob(UnifiedJob, WorkflowJobOptions, SurveyJobMixin, JobNotificatio
|
||||
'this is not normal and suggests task manager degeneracy.')
|
||||
break
|
||||
wj_ids.add(wj.pk)
|
||||
ancestors.append(wj.workflow_job_template_id)
|
||||
ancestors.append(wj.workflow_job_template)
|
||||
wj = wj.get_workflow_job()
|
||||
return ancestors
|
||||
|
||||
|
||||
@@ -124,17 +124,18 @@ class TaskManager():
|
||||
can_start = True
|
||||
if isinstance(spawn_node.unified_job_template, WorkflowJobTemplate):
|
||||
workflow_ancestors = job.get_ancestor_workflows()
|
||||
if spawn_node.unified_job_template.id in set(workflow_ancestors):
|
||||
if spawn_node.unified_job_template in set(workflow_ancestors):
|
||||
can_start = False
|
||||
logger.info('Refusing to start recursive workflow-in-workflow id={}, wfjt={}, ancestors={}'.format(
|
||||
job.id, spawn_node.unified_job_template.id, workflow_ancestors))
|
||||
job.id, spawn_node.unified_job_template.pk, [wa.pk for wa in workflow_ancestors]))
|
||||
display_list = [spawn_node.unified_job_template] + workflow_ancestors
|
||||
job.job_explanation = _(
|
||||
"Workflow Job spawned from workflow could not start because it "
|
||||
"would result in recursion (template spawn order {})"
|
||||
).format([spawn_node.unified_job_template.id] + workflow_ancestors)
|
||||
"would result in recursion (spawn order, most recent first: {})"
|
||||
).format(six.text_type(', ').join([six.text_type('<{}>').format(tmp) for tmp in display_list]))
|
||||
else:
|
||||
logger.debug('Starting workflow-in-workflow id={}, wfjt={}, ancestors={}'.format(
|
||||
job.id, spawn_node.unified_job_template.id, workflow_ancestors))
|
||||
job.id, spawn_node.unified_job_template.pk, [wa.pk for wa in workflow_ancestors]))
|
||||
if not job._resources_sufficient_for_launch():
|
||||
can_start = False
|
||||
job.job_explanation = _("Job spawned from workflow could not start because it "
|
||||
|
||||
@@ -249,7 +249,7 @@ def test_workflow_ancestors(organization):
|
||||
job=parent_job
|
||||
)
|
||||
# ancestors method gives a list of WFJT ids
|
||||
assert child_job.get_ancestor_workflows() == [parent.pk, grandparent.pk]
|
||||
assert child_job.get_ancestor_workflows() == [parent, grandparent]
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
|
||||
Reference in New Issue
Block a user