def _make_engine(self, flow, flow_detail=None):
     return eng.SingleThreadedActionEngine(flow, flow_detail=flow_detail)
示例#2
0
    def revert(self, joe_number, *args, **kwargs):
        print("Calling %s and apologizing." % joe_number)


class CallSuzzie(task.Task):
    def execute(self, suzzie_number, *args, **kwargs):
        raise IOError("Suzzie not home right now.")

    def revert(self, suzzie_number, *args, **kwargs):
        # TODO(imelnikov): this method should not be requred
        pass


flow = lf.Flow('simple-linear').add(
    CallJim(),
    CallJoe(),
    CallSuzzie()
)
engine = eng.SingleThreadedActionEngine(flow)

engine.storage.inject({
    "joe_number": 444,
    "jim_number": 555,
    "suzzie_number": 666
})

try:
    engine.run()
except Exception as e:
    print "Flow failed: %r" % e
示例#3
0
def _make_engine(flow):
    e = eng.SingleThreadedActionEngine(flow)
    e.compile()
    return e
示例#4
0
def _make_engine(flow):
    e = eng.SingleThreadedActionEngine(flow)
    e.compile()
    e.storage.inject([('context', {})])
    return e