Exemple #1
0
 def start(self):
     filter1, filter2, printer  = TrueFilter(), FalseFilter(), Printer(),
     logger, collector = Logger(), Joiner()   
     print 'collector_id before start:' + collector.id
     wf = Workflow([filter1, filter2, printer, logger, collector])
     [filter1, filter2, printer, logger, collector] = list(wf.start())
     print 'collector_id after start:' + collector.id
     
     time.sleep(2)
     
     [filter1, filter2] |join| collector
     collector |multiplex| [printer, logger]
     
     filter1.call('filter', {'msg':'Ihu'})
     filter2.call('filter', {'msg' :'Ahu'})
Exemple #2
0
def start_group(actor_type, count):
    actor_group = []
    [actor_group.append(instantiate(actor_type)) for _ in range(0, count)]
    wf = Workflow(actor_group)
    remote_group = list(wf.start())
    return remote_group