Пример #1
0
 def test_connected_nodes_are_pipelines(self):
     node_a = PipelineNode(count)
     node_b = PipelineNode(increment)
     node_a.connect(node_b)
     self.assertIn(node_b, node_a.neighbors)
Пример #2
0

@pipeline_node
def count():
    for i in range(50):
        yield i


@pipeline_node
def increment(i):
    return i + 1


increment2 = PipelineNode(increment)


@pipeline_node
def log(i):
    print(i)


count.connect(increment, increment2)
increment.connect(log)
increment2.connect(log)

t_pype = ThreadPipelineFactory()
t_pype.run_pipeline(count)

p_pype = ProcessPipelineFactory()
p_pype.run_pipeline(count)