Ejemplo n.º 1
0
    def create(cls, session, workflow_id, name=None, **attrs):
        try:
            workflow = Workflow.load(session, id=workflow_id)
        except NoResultFound:
            raise OperationError("unknown-workflow")

        if not name:
            name = workflow.name

        run = cls(name=name, workflow_id=workflow.id, **attrs)
        session.add(run)
        return run
Ejemplo n.º 2
0
    def create(cls, session, workflow_id, name=None, **attrs):
        try:
            workflow = Workflow.load(session, id=workflow_id)
        except NoResultFound:
            raise OperationError('unknown-workflow')

        if not name:
            name = workflow.name

        run = cls(name=name, workflow_id=workflow.id, **attrs)
        session.add(run)
        return run
Ejemplo n.º 3
0
    def create(cls, session, workflow_id, name=None, parameters=None, **attrs):
        try:
            workflow = Workflow.load(session, id=workflow_id)
        except NoResultFound:
            raise OperationError('unknown-workflow')

        workflow_schema = workflow.workflow.schema
        if workflow_schema and parameters:
            workflow_schema.process(parameters, serialized=True, partial=True)

        if name:
            if session.query(cls).filter_by(name=name).count():
                raise OperationError(token='duplicate-run-name')
        else:
            name = workflow.name

        run = cls(name=name, workflow_id=workflow.id, parameters=parameters, **attrs)
        session.add(run)
        return run