diff --git a/Pipfile.lock b/Pipfile.lock index 8050cb3a..90465cc6 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -783,7 +783,7 @@ "spiffworkflow": { "editable": true, "git": "https://github.com/sartography/SpiffWorkflow.git", - "ref": "f626ac6d4f035f3a65a058320efd8d33d1ec652a" + "ref": "bb83497f5128f6221113b090d8de84401b0f108f" }, "sqlalchemy": { "hashes": [ diff --git a/crc/api/workflow.py b/crc/api/workflow.py index 63cace60..de67c87f 100644 --- a/crc/api/workflow.py +++ b/crc/api/workflow.py @@ -85,8 +85,7 @@ def delete_workflow_specification(spec_id): def __get_workflow_api_model(processor: WorkflowProcessor): spiff_tasks = processor.get_all_user_tasks() - user_tasks = list(map(WorkflowService.spiff_task_to_api_task, spiff_tasks)) - + user_tasks = [WorkflowService.spiff_task_to_api_task(t, add_docs_and_forms=True) for t in spiff_tasks] workflow_api = WorkflowApi( id=processor.get_workflow_id(), status=processor.get_status(), diff --git a/crc/services/workflow_processor.py b/crc/services/workflow_processor.py index 7430c9db..ce85b43d 100644 --- a/crc/services/workflow_processor.py +++ b/crc/services/workflow_processor.py @@ -163,10 +163,14 @@ class WorkflowProcessor(object): Useful for running the master specification, which should not persist. """ version = WorkflowProcessor.get_latest_version_string(spec_model.id) spec = WorkflowProcessor.get_spec(spec_model.id, version) - bpmn_workflow = BpmnWorkflow(spec, script_engine=WorkflowProcessor._script_engine) - bpmn_workflow.data[WorkflowProcessor.STUDY_ID_KEY] = study.id - bpmn_workflow.data[WorkflowProcessor.VALIDATION_PROCESS_KEY] = False - bpmn_workflow.do_engine_steps() + try: + bpmn_workflow = BpmnWorkflow(spec, script_engine=WorkflowProcessor._script_engine) + bpmn_workflow.data[WorkflowProcessor.STUDY_ID_KEY] = study.id + bpmn_workflow.data[WorkflowProcessor.VALIDATION_PROCESS_KEY] = False + bpmn_workflow.do_engine_steps() + except WorkflowException as we: + raise ApiError.from_task_spec("error_running_master_spec", str(we), we.sender) + if not bpmn_workflow.is_completed(): raise ApiError("master_spec_not_automatic", "The master spec should only contain fully automated tasks, it failed to complete.")