corelay.processor.base
Base classes Param and Processor.
Functions
Make sure argument is a Processor and, if it is not, but callable, make it a FunctionProcessor. |
Classes
Processor instance initialized with a supplied function |
|
Base class of processors of tasks in a pipeline instance. |
- class corelay.processor.base.FunctionProcessor(*args, **kwargs)[source]
Bases:
ProcessorProcessor instance initialized with a supplied function
- function
The function around which to create the
FunctionProcessor. It wil be bound as a method if bind_method.- Type:
types.FunctionTypeortypes.MethodType
- bind_method
Will bind function to this class, enabling it to access self.
- Type:
bool
- class corelay.processor.base.Processor(*args, **kwargs)[source]
Bases:
PlugboardBase class of processors of tasks in a pipeline instance.
- is_output
Assigned as
Param, will be assigned as an instance attribute in __init__. Defines whether the Processor should yield an output for a Pipeline.- Type:
bool
- is_checkpoint
Assigned as
Param, will be assigned as an instance attribute in __init__. Defines whether checkpointed pipeline computations should start at this point, if there exists a previously computed checkpoint value.- Type:
bool
- checkpoint_data
If this Processor is a checkpoint, and if the Processor was called at least once, stores the output of this processor.
- Type:
object
- copy()[source]
Copy self, creating a new Processor instance with the same values for
Paramattribute defined parameters.- Returns:
New instance with copied parameter values.
- Return type:
- abstract function(data)[source]
Abstract function this Processor should apply on input
- Parameters:
data (object) – Input data to this Processor.
- Raises:
NotImplementedError – Always, since this is an abstract function.
- corelay.processor.base.ensure_processor(proc, **kwargs)[source]
Make sure argument is a Processor and, if it is not, but callable, make it a FunctionProcessor. Set attributes of resulting processor as stated in **kwargs.
- Parameters:
- Returns:
Original object proc with updated attributes if it was a Processor, else a
FunctionProcessorwith supplied function. proc and attributes as given in **kwargs.- Return type: