Ejemplo n.º 1
0
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]}
Ejemplo n.º 2
0
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)
    }
Ejemplo n.º 3
0
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)
    }
Ejemplo n.º 4
0
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 {}
Ejemplo n.º 5
0
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]
    }
Ejemplo n.º 6
0
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 {}
Ejemplo n.º 7
0
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 {}
Ejemplo n.º 8
0
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 {}
Ejemplo n.º 9
0
def list_artifacts(request_handler, study_id):
    artifacts = Study.get(id=study_id).artifacts

    return {'artifacts': [a.uri for a in artifacts]}
Ejemplo n.º 10
0
def study_info(request_handler, study_id):
    study = Study.get(Study.id == study_id)
    study.delete_instance()  # TODO think about cascading deletes

    return {}
Ejemplo n.º 11
0
def create_study(request_handler, name, description):
    study = Study(name=name, description=description)
    study.save()
    return {'study': study.uri}
Ejemplo n.º 12
0
def create_study(request_handler, name, description):
    study = Study(name=name, description=description)
    study.save()
    return {
        'study': study.uri
    }
Ejemplo n.º 13
0
def list_workflows(request_handler, study_id):
    workflows = Study.get(id=study_id).workflows

    return {
        'workflows': [w.uri for w in workflows]
    }
Ejemplo n.º 14
0
def list_artifacts(request_handler, study_id):
    artifacts = Study.get(id=study_id).artifacts

    return {
        'artifacts': [a.uri for a in artifacts]
    }
Ejemplo n.º 15
0
def study_info(request_handler, study_id):
    study = Study.get(Study.id == study_id)
    study.delete_instance() # TODO think about cascading deletes

    return {}
Ejemplo n.º 16
0
def list_studies(request_handler):
    return {'studies': [study.uri for study in Study.select()]}
Ejemplo n.º 17
0
def list_workflows(request_handler, study_id):
    workflows = Study.get(id=study_id).workflows

    return {'workflows': [w.uri for w in workflows]}
Ejemplo n.º 18
0
def list_studies(request_handler):
    return {
        'studies': [study.uri for study in Study.select()]
    }