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

Class TaskCallable


Abstract base class for task callables.

This class encapsulates the task behavior and the related fixed data
(data which stays constant over multiple tasks).

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 only called when the callable is first called in a different Python process / environment.

Inherited from unreachable.newobject: __long__, __native__, __nonzero__, __unicode__, next

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

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 called exactly once before a callable is called,
so instead of the original callable a fresh fork is called. This
ensures that the original callable is preserved when caching is used.
If the callable is not modified by the call then it can simply return
itself.

setup_environment(self)

 
This hook method is only called when the callable is first called
in a different Python process / environment.

It can be used for modifications in the Python environment that are
required by this callable.