We want to modify the master workflow so that it returns both a status, and a message explaining the status for each workflow.
I.e., from status = {'ids_full_submission': 'required', 'enter_core_info': 'disabled', ...} to status = {'ids_full_submission': {'status': 'required', 'message': 'required because...'}, 'enter_core_info': {'status': 'disabled', 'message': 'disabled because...'}, ...} Modified study_service.__update_status_of_workflow_meta to accommodate this change.
This commit is contained in:
parent
14386b8ba9
commit
c05b879dd4
|
@ -421,13 +421,15 @@ class StudyService(object):
|
||||||
warnings = []
|
warnings = []
|
||||||
for wfm in workflow_metas:
|
for wfm in workflow_metas:
|
||||||
if wfm.name in status.keys():
|
if wfm.name in status.keys():
|
||||||
if not WorkflowState.has_value(status[wfm.name]):
|
if not WorkflowState.has_value(status[wfm.name]['status']):
|
||||||
warnings.append(ApiError("invalid_status",
|
warnings.append(ApiError("invalid_status",
|
||||||
"Workflow '%s' can not be set to '%s', should be one of %s" % (
|
"Workflow '%s' can not be set to '%s', should be one of %s" % (
|
||||||
wfm.name, status[wfm.name], ",".join(WorkflowState.list())
|
wfm.name, status[wfm.name], ",".join(WorkflowState.list())
|
||||||
)))
|
)))
|
||||||
else:
|
else:
|
||||||
wfm.state = WorkflowState[status[wfm.name]]
|
wfm.state = WorkflowState[status[wfm.name]['status']]
|
||||||
|
if status[wfm.name]['message']:
|
||||||
|
wfm.state_message = status[wfm.name]['message']
|
||||||
else:
|
else:
|
||||||
warnings.append(ApiError("missing_status", "No status specified for workflow %s" % wfm.name))
|
warnings.append(ApiError("missing_status", "No status specified for workflow %s" % wfm.name))
|
||||||
return warnings
|
return warnings
|
||||||
|
|
Loading…
Reference in New Issue