Package mdp :: Package parallel :: Class TaskCallable
[hide private]
[frames] | no frames]

Class TaskCallable


Abstract base class for callables.

Instance Methods [hide private]
 
__call__(self, data)
Perform the computation and return the result.
 
fork(self)
Return a fork of this callable, e.g.
 
setup_environment(self)
This hook method is called when the callable is first loaded.

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__call__(self, data)
(Call operator)

 
Perform the computation and return the result.

Override this method with a concrete implementation.

fork(self)

 
Return a fork of this callable, e.g. by making a copy.

This method is always used before a callable is actually called, so
instead of the original callable the fork is called. The ensures that
the original callable is preserved when cachin is used. If the callable
is not modified by the call it can simply return itself.  

setup_environment(self)

 
This hook method is called when the callable is first loaded.

It should be used to make any required modifications in the Python
environment that are required by this callable.