def main(): def event_log(event): print " -> spec %s, %s" % (event.task.get_name(), event.type) CoreWFManager.reset() workflow_spec = CoreWFManager.get_workflow_spec("SplitWorkflow") workflow_spec.on("executed", event_log) workflow_spec.on("enter", event_log) workflow_spec.on("ready", event_log) workflow_spec.on("completed", event_log) workflow = Workflow(workflow_spec) workflow.start() workflow.run()
def test_workflow(self): workflow_spec = CoreWFManager.get_workflow_spec('TestWorkflow') workflow = Workflow(workflow_spec) def event_log(event): print "Event ... %s " % event.type print " .... spec %s" % event.task.get_name() workflow_spec.on("ready", event_log) workflow_spec.on("executed", event_log) workflow_spec.on("completed", event_log) workflow.start()
def main(): CoreWFManager.reset() workflow_spec = CoreWFManager.get_workflow_spec('MultiChoiceWorkflow') count = [0, 0, 0] for i in range(0, 100): workflow = Workflow(workflow_spec) workflow.start() workflow.run() flows = workflow.get_data("flows") for flow in flows: if flow == "A": count[0] = count[0] + 1 elif flow == "B": count[1] = count[1] + 1 elif flow == "C": count[2] = count[2] + 1 print count
def main(): def event_log(event): print " -> spec %s, %s" % (event.task.get_name(), event.type) CoreWFManager.reset() workflow_spec = CoreWFManager.get_workflow_spec('ChoiceWorkflow01') count = [0, 0] for i in range(0, 100): workflow = Workflow(workflow_spec) workflow.start() workflow.run() flow = workflow.get_data("flow") if flow == "A": count[0] = count[0] + 1 else: count[1] = count[1] + 1 print "flow A: %d" % count[0] print "flow B: %d" % count[1]
from redbreast.core.spec import CoreWFManager from redbreast.core.spec import * from redbreast.core import Workflow, Task from os.path import dirname, join def event_log(event): print " --> spec %s, %s" % (event.task.get_name(), event.type) CoreWFManager.reset() storage = WFConfigStorage() CoreWFManager.set_storage(storage) config_file = join(dirname(__file__), "data/Sandbox2.config") storage.load_config_file(config_file) workflow_spec = CoreWFManager.get_workflow_spec('TestWorkflow') #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() print "---------RUN-------------------" workflow.task_tree.dump()
from redbreast.core.spec import CoreWFManager from redbreast.core.spec import * from redbreast.core import Workflow, Task from os.path import dirname, join def event_log(event): print " -> spec %s, %s" % (event.task.get_name(), event.type) CoreWFManager.reset() storage = WFConfigStorage() CoreWFManager.set_storage(storage) config_file = join(dirname(__file__), "data/Sandbox2.config") storage.load_config_file(config_file) workflow_spec = CoreWFManager.get_workflow_spec('TestWorkflow') #workflow_spec.on("ready", event_log) workflow_spec.on("executed", event_log) #workflow_spec.on("completed", event_log) workflow_spec.dump() workflow = Workflow(workflow_spec) print "---------START-------------------" workflow.start(start='start1') workflow.run() print "---------RUN-------------------" workflow.task_tree.dump()
from redbreast.core.spec import * from redbreast.core import Workflow, Task from os.path import dirname, join def event_log(event): print " --> spec %s, %s" % (event.task.get_name(), event.type) CoreWFManager.reset() storage = WFConfigStorage() CoreWFManager.set_storage(storage) config_file = join(dirname(__file__), "data/Sandbox2.config") storage.load_config_file(config_file) workflow_spec = CoreWFManager.get_workflow_spec('TestWorkflow') #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() print "---------RUN-------------------" workflow.task_tree.dump()