We now check for an infinite loop during validation.
This happened when testing for a Department Chair in a workflow. Our mocked data for study_info script did not have a Department Chair
This commit is contained in:
parent
14386b8ba9
commit
529bfc34b3
|
@ -95,31 +95,37 @@ class WorkflowService(object):
|
||||||
WorkflowService.delete_test_data()
|
WorkflowService.delete_test_data()
|
||||||
raise ApiError.from_workflow_exception("workflow_validation_exception", str(we), we)
|
raise ApiError.from_workflow_exception("workflow_validation_exception", str(we), we)
|
||||||
|
|
||||||
|
count = 0
|
||||||
while not processor.bpmn_workflow.is_completed():
|
while not processor.bpmn_workflow.is_completed():
|
||||||
try:
|
if count < 1000:
|
||||||
processor.bpmn_workflow.get_deep_nav_list() # Assure no errors with navigation.
|
try:
|
||||||
processor.bpmn_workflow.do_engine_steps()
|
processor.bpmn_workflow.get_deep_nav_list() # Assure no errors with navigation.
|
||||||
tasks = processor.bpmn_workflow.get_tasks(SpiffTask.READY)
|
processor.bpmn_workflow.do_engine_steps()
|
||||||
for task in tasks:
|
tasks = processor.bpmn_workflow.get_tasks(SpiffTask.READY)
|
||||||
if task.task_spec.lane is not None and task.task_spec.lane not in task.data:
|
for task in tasks:
|
||||||
raise ApiError.from_task("invalid_role",
|
if task.task_spec.lane is not None and task.task_spec.lane not in task.data:
|
||||||
f"This task is in a lane called '{task.task_spec.lane}', The "
|
raise ApiError.from_task("invalid_role",
|
||||||
f" current task data must have information mapping this role to "
|
f"This task is in a lane called '{task.task_spec.lane}', The "
|
||||||
f" a unique user id.", task)
|
f" current task data must have information mapping this role to "
|
||||||
task_api = WorkflowService.spiff_task_to_api_task(
|
f" a unique user id.", task)
|
||||||
task,
|
task_api = WorkflowService.spiff_task_to_api_task(
|
||||||
add_docs_and_forms=True) # Assure we try to process the documentation, and raise those errors.
|
task,
|
||||||
# make sure forms have a form key
|
add_docs_and_forms=True) # Assure we try to process the documentation, and raise those errors.
|
||||||
if hasattr(task_api, 'form') and task_api.form is not None and task_api.form.key == '':
|
# make sure forms have a form key
|
||||||
raise ApiError(code='missing_form_key',
|
if hasattr(task_api, 'form') and task_api.form is not None and task_api.form.key == '':
|
||||||
message='Forms must include a Form Key.',
|
raise ApiError(code='missing_form_key',
|
||||||
task_id=task.id,
|
message='Forms must include a Form Key.',
|
||||||
task_name=task.get_name())
|
task_id=task.id,
|
||||||
WorkflowService.populate_form_with_random_data(task, task_api, required_only)
|
task_name=task.get_name())
|
||||||
processor.complete_task(task)
|
WorkflowService.populate_form_with_random_data(task, task_api, required_only)
|
||||||
except WorkflowException as we:
|
processor.complete_task(task)
|
||||||
WorkflowService.delete_test_data()
|
count += 1
|
||||||
raise ApiError.from_workflow_exception("workflow_validation_exception", str(we), we)
|
except WorkflowException as we:
|
||||||
|
WorkflowService.delete_test_data()
|
||||||
|
raise ApiError.from_workflow_exception("workflow_validation_exception", str(we), we)
|
||||||
|
else:
|
||||||
|
raise ApiError.from_workflow_exception(code='validation_loop',
|
||||||
|
message=f'There appears to be an infinite loop in the validation. spec_id: {spec_id}')
|
||||||
|
|
||||||
WorkflowService.delete_test_data()
|
WorkflowService.delete_test_data()
|
||||||
WorkflowService._process_documentation(processor.bpmn_workflow.last_task.parent.parent)
|
WorkflowService._process_documentation(processor.bpmn_workflow.last_task.parent.parent)
|
||||||
|
|
Loading…
Reference in New Issue