def list_jobs(request_handler, study_id, status=None): jobs = Study.get(id=study_id).jobs if status is not None: jobs = jobs.where(Job.status == status) return {'jobs': [j.uri for j in jobs]}
def study_info(request_handler, study_id): study = Study.get(Study.id == study_id) return { 'name': study.name, 'description': study.description, 'created': str(study.created) }
def study_info(request_handler, study_id, name=None, description=None): study = Study.get(Study.id == study_id) if name is not None: study.name = name if description is not None: study.description = description study.save() return {}
def list_jobs(request_handler, study_id, status=None): jobs = Study.get(id=study_id).jobs if status is not None: jobs = jobs.where(Job.status == status) return { 'jobs': [j.uri for j in jobs] }
def create_artifact(request_handler, study_id, name, artifact_type): data = _get_file_data(request_handler.request) if data is None: raise ValueError("Cannot create artifact: missing uploaded file.") # TODO remove when using postgresql and foreign keys are actually supported study = Study.get(id=study_id) type_ = Type.get(uri=artifact_type) artifact = Artifact(type=type_, data=data, study=study) artifact.save() artifact_proxy = ArtifactProxy(name=name, artifact=artifact, study=study) artifact_proxy.save() return {}
def list_artifacts(request_handler, study_id): artifacts = Study.get(id=study_id).artifacts return {'artifacts': [a.uri for a in artifacts]}
def study_info(request_handler, study_id): study = Study.get(Study.id == study_id) study.delete_instance() # TODO think about cascading deletes return {}
def create_study(request_handler, name, description): study = Study(name=name, description=description) study.save() return {'study': study.uri}
def create_study(request_handler, name, description): study = Study(name=name, description=description) study.save() return { 'study': study.uri }
def list_workflows(request_handler, study_id): workflows = Study.get(id=study_id).workflows return { 'workflows': [w.uri for w in workflows] }
def list_artifacts(request_handler, study_id): artifacts = Study.get(id=study_id).artifacts return { 'artifacts': [a.uri for a in artifacts] }
def list_studies(request_handler): return {'studies': [study.uri for study in Study.select()]}
def list_workflows(request_handler, study_id): workflows = Study.get(id=study_id).workflows return {'workflows': [w.uri for w in workflows]}
def list_studies(request_handler): return { 'studies': [study.uri for study in Study.select()] }