def perform_test(self, values): workflow = ppw.Workflow() workflow.add_task(ppw.GeneratorTask(self.gen_producer(values)), outputs=["1"]) workflow.add_task(ppw.SimpleTask(self.gen_worker()), input="1", runner_count=4) workflow.add_task(ppw.SimpleTask(self.gen_worker()), input="1", runner_count=4) workflow.run() self.assertEqual(values, self.test_value.value) self.assertEqual(values * 2, self.test_value.calls)
def perform_test(self, values): workflow = ppw.Workflow() workflow.add_task(ppw.GeneratorTask(self.gen_producer(values)), outputs=["1"]) workflow.add_task(ppw.SimpleTask( self.gen_worker(status=True, output="2")), input="1", outputs=["2", "status"], runner_count=4) workflow.add_task(ppw.SimpleTask(self.gen_worker(status=True)), input="2", outputs=["status"], runner_count=4) workflow.add_task(ppw.StatusTask(sys.stdout), input="status") workflow.run() self.assertEqual(values, self.test_value.value) self.assertEqual(values * 2, self.test_value.calls)
def perform_test(self, values): workflow = ppw.Workflow() workflow.add_task(ppw.GeneratorTask(self.gen_producer(values)), outputs=["1"]) workflow.add_task(ppw.SimpleTask(self.gen_worker(output="2")), input="1", outputs=["2"], runner_count=4, max_input_size=1) workflow.add_task(ppw.SimpleTask(self.gen_worker(many=3)), input="2", runner_count=4, max_input_size=2) workflow.add_task(ppw.SimpleTask(self.gen_worker(many=2)), input="2", runner_count=4) workflow.run() self.assertEqual(values, self.test_value.value) self.assertEqual(values * 3, self.test_value.calls)