def __init__(self, core_classes_map):
"""Creates a Pipeline object.
Args:
core_classes_map (list[dict]): Each element in the list corresponds to a Core. The element must be a
dictionary with the key Pipeline.KEY_CLASS and value the class that should be instantiated (the Core
subclass). You can provide arguments to the constructor using the key Pipeline.KEY_KWARGS.
"""
self.input_pipe, self.output_pipe = self._construct_pipes(core_classes_map)
# Instantiate the core classes, connecting them with the created pipes
self.cores = [core_class[self.KEY_CLASS](**core_class[self.KEY_KWARGS]) for core_class in core_classes_map]
self.started = False
self.results_manager = Manager()
self.results = self.results_manager.dict()
self.results_producer = PipeConsumer(self.output_pipe, self.results)
评论列表
文章目录