Пример #1
0
def workflow_get_all(context):
    """Return all workflows"""
    results = model_query(context, models.Workflow).all()

    if not results:
        raise exception.NotFound("No Workflows were found.")

    return results
Пример #2
0
def logbook_get_by_name(context, lb_name):
    """Return all logbooks with matching name"""
    query = model_query(context, models.LogBook).\
        filter_by(name=lb_name)

    if not query.all():
        raise exception.NotFound("LogBook %s not found." % (lb_name, ))

    return query.all()
Пример #3
0
def logbook_get(context, lb_id, session=None):
    """Return a logbook with matching lb_id"""
    query = model_query(context, models.LogBook, session=session).\
        filter_by(logbook_id=lb_id)

    if not query.first():
        raise exception.NotFound("No LogBook found with id " "%s." % (lb_id, ))

    return query.first()
Пример #4
0
def task_get(context, task_id, session=None):
    """Return Task with task_id"""
    query = model_query(context, models.Task, session=session).\
        filter_by(task_id=task_id)

    if not query.first():
        raise exception.NotFound("No Task found with id " "%s." % (task_id, ))

    return query.first()
Пример #5
0
def workflow_get(context, wf_name, session=None):
    """Return one workflow with matching workflow_id"""
    query = model_query(context, models.Workflow, session=session).\
        filter_by(name=wf_name)

    if not query.first():
        raise exception.NotFound("Workflow %s not found." % (wf_name, ))

    return query.first()
Пример #6
0
def job_get(context, job_id, session=None):
    """Return Job with matching job_id"""
    query = model_query(context, models.Job, session=session).\
        filter_by(job_id=job_id)

    if not query.first():
        raise exception.NotFound("No Job with id %s found" % (job_id, ))

    return query.first()