Exemplo n.º 1
0
def job_update(context, job_id, values):
    """Update job with given values"""
    session = get_session()
    with session.begin():
        job = job_get(context, job_id, session=session)
        job.update(values)
        job.save(session=session)
Exemplo n.º 2
0
def logbook_get_workflows(context, lb_id):
    """Return all workflows associated with a logbook"""
    session = get_session()
    with session.begin():
        lb = logbook_get(context, lb_id, session=session)

    return lb.workflows
Exemplo n.º 3
0
def job_update(context, job_id, values):
    """Update job with given values"""
    session = get_session()
    with session.begin():
        job = job_get(context, job_id, session=session)
        job.update(values)
        job.save(session=session)
Exemplo n.º 4
0
def workflow_get_tasks(context, wf_name):
    """Return all tasks for a given Workflow"""
    session = get_session()
    with session.begin():
        wf = workflow_get(context, wf_name, session=session)

    return wf.tasks
Exemplo n.º 5
0
def workflow_get_tasks(context, wf_name):
    """Return all tasks for a given Workflow"""
    session = get_session()
    with session.begin():
        wf = workflow_get(context, wf_name, session=session)

    return wf.tasks
Exemplo n.º 6
0
def logbook_get_workflows(context, lb_id):
    """Return all workflows associated with a logbook"""
    session = get_session()
    with session.begin():
        lb = logbook_get(context, lb_id, session=session)

    return lb.workflows
Exemplo n.º 7
0
def job_add_workflow(context, job_id, wf_id):
    """Add a Workflow to given job"""
    session = get_session()
    with session.begin():
        job = job_get(context, job_id, session=session)
        wf = workflow_get(context, wf_id, session=session)
        job.workflows.append(wf)
    return job.workflows
Exemplo n.º 8
0
def task_update(context, task_id, values):
    """Update Task with given values"""
    session = get_session()
    with session.begin():
        task = task_get(context, task_id)

        task.update(values)
        task.save(session=session)
Exemplo n.º 9
0
def workflow_add_task(context, wf_id, task_id):
    """Add a task to a given workflow"""
    session = get_session()
    with session.begin():
        task = task_get(context, task_id, session=session)
        wf = workflow_get(context, wf_id, session=session)
        wf.tasks.append(task)
        return wf.tasks
Exemplo n.º 10
0
def workflow_add_task(context, wf_id, task_id):
    """Add a task to a given workflow"""
    session = get_session()
    with session.begin():
        task = task_get(context, task_id, session=session)
        wf = workflow_get(context, wf_id, session=session)
        wf.tasks.append(task)
        return wf.tasks
Exemplo n.º 11
0
def task_update(context, task_id, values):
    """Update Task with given values"""
    session = get_session()
    with session.begin():
        task = task_get(context, task_id)

        task.update(values)
        task.save(session=session)
Exemplo n.º 12
0
def job_add_workflow(context, job_id, wf_id):
    """Add a Workflow to given job"""
    session = get_session()
    with session.begin():
        job = job_get(context, job_id, session=session)
        wf = workflow_get(context, wf_id, session=session)
        job.workflows.append(wf)
    return job.workflows
Exemplo n.º 13
0
 def delete(self, session=None):
     """Delete this object."""
     self.deleted = True
     self.deleted_at = timeutils.utcnow()
     if not session:
         session = get_session()
     session.delete(self)
     session.flush()
Exemplo n.º 14
0
def logbook_add_workflow(context, lb_id, wf_name):
    """Add Workflow to given LogBook"""
    session = get_session()
    with session.begin():
        wf = workflow_get(context, wf_name, session=session)
        lb = logbook_get(context, lb_id, session=session)

        lb.workflows.append(wf)

    return lb.workflows
Exemplo n.º 15
0
def logbook_add_workflow(context, lb_id, wf_name):
    """Add Workflow to given LogBook"""
    session = get_session()
    with session.begin():
        wf = workflow_get(context, wf_name, session=session)
        lb = logbook_get(context, lb_id, session=session)

        lb.workflows.append(wf)

    return lb.workflows
Exemplo n.º 16
0
 def save(self, session=None):
     """Save this object."""
     if not session:
         session = get_session()
     session.add(self)
     try:
         session.flush()
     except IntegrityError, e:
         if str(e).endswith('is not unique'):
             raise exception.Duplicate(str(e))
         else:
             raise
Exemplo n.º 17
0
def model_query(context, *args, **kwargs):
    session = kwargs.get('session') or get_session()
    query = session.query(*args)

    return query
Exemplo n.º 18
0
def job_get_logbook(context, job_id):
    """Return the logbook associated with the given job"""
    session = get_session()
    with session.begin():
        job = job_get(context, job_id, session=session)
    return job.logbook
Exemplo n.º 19
0
def task_destroy(context, task_id):
    """Delete an existing Task"""
    session = get_session()
    with session.begin():
        task = task_get(context, task_id, session=session)
        task.delete(session=session)
Exemplo n.º 20
0
def job_destroy(context, job_id):
    """Delete a given Job"""
    session = get_session()
    with session.begin():
        job = job_get(context, job_id, session=session)
        job.delete(session=session)
Exemplo n.º 21
0
def workflow_destroy(context, wf_name):
    """Delete a given Workflow"""
    session = get_session()
    with session.begin():
        wf = workflow_get(context, wf_name, session=session)
        wf.delete(session=session)
Exemplo n.º 22
0
def workflow_destroy(context, wf_name):
    """Delete a given Workflow"""
    session = get_session()
    with session.begin():
        wf = workflow_get(context, wf_name, session=session)
        wf.delete(session=session)
Exemplo n.º 23
0
def job_destroy(context, job_id):
    """Delete a given Job"""
    session = get_session()
    with session.begin():
        job = job_get(context, job_id, session=session)
        job.delete(session=session)
Exemplo n.º 24
0
def job_get_logbook(context, job_id):
    """Return the logbook associated with the given job"""
    session = get_session()
    with session.begin():
        job = job_get(context, job_id, session=session)
    return job.logbook
Exemplo n.º 25
0
def task_destroy(context, task_id):
    """Delete an existing Task"""
    session = get_session()
    with session.begin():
        task = task_get(context, task_id, session=session)
        task.delete(session=session)
Exemplo n.º 26
0
def model_query(context, *args, **kwargs):
    session = kwargs.get('session') or get_session()
    query = session.query(*args)

    return query
Exemplo n.º 27
0
def logbook_destroy(context, lb_id):
    """Delete a given LogBook"""
    session = get_session()
    with session.begin():
        lb = logbook_get(context, lb_id, session=session)
        lb.delete(session=session)
Exemplo n.º 28
0
def logbook_destroy(context, lb_id):
    """Delete a given LogBook"""
    session = get_session()
    with session.begin():
        lb = logbook_get(context, lb_id, session=session)
        lb.delete(session=session)