Added methods for the 2 new api endpoints

This commit is contained in:
mike cullerton 2021-04-26 08:43:14 -04:00
parent 1f50bdcb81
commit b6f5001687
1 changed files with 16 additions and 0 deletions

View File

@ -783,3 +783,19 @@ class WorkflowService(object):
for workflow in workflows:
if workflow.status == WorkflowStatus.user_input_required or workflow.status == WorkflowStatus.waiting:
WorkflowProcessor.reset(workflow, clear_data=False)
@staticmethod
def get_workflow_from_spec(workflow_spec_id, user):
workflow_model = WorkflowModel(status=WorkflowStatus.not_started,
study=None,
user_id=user.uid,
workflow_spec_id=workflow_spec_id,
last_updated=datetime.now())
db.session.add(workflow_model)
db.session.commit()
return workflow_model
@staticmethod
def get_standalone_workflow_specs():
specs = db.session.query(WorkflowSpecModel).filter_by(standalone=True).all()
return specs