def count_by_group(): composite = CompositePE() count = CountByGroup() merge = CountByGroup() merge._add_input('input', grouping='global') composite.connect(count, 'output', merge, 'input') composite._map_input('input', count, 'input') composite._map_output('output', merge, 'output') return composite
def testComposite(): comp = CompositePE() cons1 = TestOneInOneOut() cons2 = TestOneInOneOut() comp.connect(cons1, "output", cons2, "input") comp._map_input("comp_input", cons1, "input") comp._map_output("comp_output", cons2, "output") prod = TestProducer() cons = TestOneInOneOut() graph = WorkflowGraph() graph.connect(prod, "output", comp, "comp_input") graph.connect(comp, "comp_output", cons, "input") graph.flatten() results = simple_process.process_and_return(graph, {prod: 10}) tools.eq_({cons.id: {"output": list(range(1, 11))}}, results)
def testComposite(): comp = CompositePE() cons1 = TestOneInOneOut() cons2 = TestOneInOneOut() comp.connect(cons1, 'output', cons2, 'input') comp._map_input('comp_input', cons1, 'input') comp._map_output('comp_output', cons2, 'output') prod = TestProducer() cons = TestOneInOneOut() graph = WorkflowGraph() graph.connect(prod, 'output', comp, 'comp_input') graph.connect(comp, 'comp_output', cons, 'input') graph.flatten() results = simple_process.process_and_return(graph, {prod: 10}) tools.eq_({cons.id: {'output': list(range(1, 11))}}, results)