pipeline module¶
- class pipeline.Buffer(*args, n=2, **kwds)[source]¶
Bases:
Processor
A Processor with an explicit buffer that can be used to adjust buffer sizes. E.g. group or split up items.
- class pipeline.Combiner(*args, n=2, **kwds)[source]¶
Bases:
Buffer
Many-to-one e.g. Combiner(n=2) transforms items into pairs of items
- class pipeline.Distributer(*args, n=2, **kwds)[source]¶
Bases:
Buffer
One-to-many e.g. Distributer(n=2) transforms pairs into items
- class pipeline.Pipeline(items=[], *, processors: List[Processor] = [])[source]¶
Bases:
Processor
A Processor that combines of multiple processing-stages.
Note that len(Pipeline) returns the length of the buffer of the whole Pipeline and not the total length of all components.
- class pipeline.Processor(items=[])[source]¶
Bases:
object
A queue-like object that can “process” items.
The superclass list allows the “queue” to be sorted and grouped. * Use .append() or .extend() to add items to the queue/buffer. * Use .process() to handle or process an item.
- static from_function(pure_func)[source]¶
Decorator that defines a “stateless” processor.
Usage¶
new_func = Processor.from_function(func)
Note that new_func and func must have the same name in order to be compatible with pickle.
Parameters¶
pure_func : (object) -> object
- class pipeline.PushPull(*args, strategy=Strategy.constant, **kwds)[source]¶
Bases:
Pipeline
- property in_queue¶
- n_processors = 1¶
- property out_queue¶
- class pipeline.Resource(processor: pipeline.Processor, delivery_queues: Tuple[queue.Queue, queue.Queue], demand_queues: Tuple[queue.Queue, queue.Queue] = None, strategy: pipeline.Strategy = <Strategy.push: 1>)[source]¶
Bases:
object