def async_deliver(self, task_obj):
        from redbreast.middleware import Workflow, Task
        wf_id = task_obj.workflow.id

        workflow = Workflow.load(wf_id, operator=task_obj._modified_user_)
        task = workflow.get_task(task_obj.uuid)
        LOG.info("------------------------------------------------")
        LOG.info("spec %s %s(%s)" % (workflow.get_spec_name(), task.get_name(), task.get_spec_name()))
        message = task.deliver_msg
        next_tasks = task.next_tasks
        workflow.deliver(task_obj.uuid, message=message, next_tasks=next_tasks, async=False)
Пример #2
0
os.chdir(locate_dir)
os.chdir('test_project')
from uliweb.manage import make_simple_application
app = make_simple_application(apps_dir='./apps')

CoreWFManager.reset()
storage = WFDatabaseStorage()
CoreWFManager.set_storage(storage)

workflow_spec = CoreWFManager.get_workflow_spec('TestWorkflow')
workflow_spec.on("enter", event_log)
workflow_spec.on("ready", event_log)
workflow_spec.on("executed", event_log)
workflow_spec.on("completed", event_log)


print "--------Workflow Spec Dump ----------------------"
workflow_spec.dump()


print "---------RUN-------------------"

workflow_id = 3
print "............", workflow_id
workflow = Workflow.load(workflow_id)
workflow.task_tree.dump()
workflow.run()


        
Пример #3
0
app = make_simple_application(apps_dir="./apps")

CoreWFManager.reset()
storage = WFDatabaseStorage()
CoreWFManager.set_storage(storage)

workflow_spec = CoreWFManager.get_workflow_spec("TestWorkflow")
workflow_spec.on("enter", event_log)
workflow_spec.on("ready", event_log)
workflow_spec.on("executed", event_log)
workflow_spec.on("completed", event_log)


print "--------Workflow Spec Dump ----------------------"
workflow_spec.dump()

workflow = Workflow(workflow_spec)
print "---------START-------------------"
workflow.start()
workflow.run_next()
workflow.run_next()
workflow.run_next()
workflow.run_next()
workflow.run_next()

print "---------RUN-------------------"
workflow.task_tree.dump()

workflow_id = workflow.get_id()
print "............", workflow_id