Removing some unused code.

This commit is contained in:
Dan 2022-05-10 09:42:23 -04:00
parent 650c63f268
commit 8d8194da45

View File

@ -104,8 +104,6 @@ class StudyService(object):
workflow_metas = StudyService._get_workflow_metas(study_id, category)
category_meta = []
if master_workflow_results:
# study.warnings = StudyService._update_status_of_workflow_meta(workflow_metas,
# master_workflow_results)
category_meta = StudyService._update_status_of_category_meta(master_workflow_results, category)
category.workflows = workflow_metas
category.meta = category_meta
@ -502,51 +500,6 @@ class StudyService(object):
if unused_statuses.get(cat.id)['message'] else ''
return cat_meta
# @staticmethod
# def _update_status_of_workflow_meta(workflow_metas, status):
# # TODO: Remove
# # This code is moving to WorkflowService.update_workflow_state_from_master_workflow
#
# # Update the status on each workflow
# warnings = []
# unused_statuses = status.copy() # A list of all the statuses that are not used.
# for wfm in workflow_metas:
# unused_statuses.pop(wfm.workflow_spec_id, None)
# wfm.state_message = ''
# # do we have a status for you
# if wfm.workflow_spec_id not in status.keys():
# warnings.append(ApiError("missing_status",
# "No status information provided about workflow %s" % wfm.workflow_spec_id))
# continue
# if not isinstance(status[wfm.workflow_spec_id], dict):
# warnings.append(ApiError(code='invalid_status',
# message=f'Status must be a dictionary with "status" and "message" keys. '
# f'Name is {wfm.workflow_spec_id}. Status is {status[wfm.workflow_spec_id]}'))
# continue
# if 'message' in status[wfm.workflow_spec_id].keys():
# wfm.state_message = status[wfm.workflow_spec_id]['message']
# if 'status' not in status[wfm.workflow_spec_id].keys():
# warnings.append(ApiError("missing_status_key",
# "Workflow '%s' is present in master workflow, but doesn't have a status" % wfm.workflow_spec_id))
# continue
# if not WorkflowState.has_value(status[wfm.workflow_spec_id]['status']):
# warnings.append(ApiError("invalid_state",
# "Workflow '%s' can not be set to '%s', should be one of %s" % (
# wfm.workflow_spec_id, status[wfm.workflow_spec_id]['status'],
# ",".join(WorkflowState.list())
# )))
# continue
#
# wfm.state = WorkflowState[status[wfm.workflow_spec_id]['status']].value
#
# for status in unused_statuses:
# if isinstance(unused_statuses[status], dict) and 'status' in unused_statuses[status]:
# warnings.append(ApiError("unmatched_status", "The master workflow provided a status for '%s' a "
# "workflow that doesn't seem to exist." %
# status))
#
# return warnings
@staticmethod
def add_all_workflow_specs_to_study(study_model: StudyModel, specs: List[WorkflowSpecInfo]):
existing_models = session.query(WorkflowModel).filter(WorkflowModel.study == study_model).all()