Module pprocess :: Class Map
[hide private]
[frames] | no frames]

Class Map

source code

Exchange --+
           |
          Map

An exchange which can be used like the built-in 'map' function.



Instance Methods [hide private]
 
__init__(self, *args, **kw)
Initialise the exchange with an optional list of 'channels'.
source code
 
init(self)
Remember the channel addition order to order output.
source code
 
add(self, channel)
Add the given 'channel' to the exchange.
source code
 
start(self, callable, *args, **kw)
Using pprocess.start, create a new process for the given 'callable' using any additional arguments provided.
source code
 
create(self)
Using pprocess.create, create a new process and return the created communications channel to the created process.
source code
 
__call__(self, callable, sequence)
Wrap and invoke 'callable' for each element in the 'sequence'.
source code
 
__getitem__(self, i) source code
 
__iter__(self) source code
 
store_data(self, channel)
Accumulate the incoming data, associating results with channels.
source code

Inherited from Exchange: active, add_wait, finish, manage, ready, remove, start_waiting, store, wait

Method Details [hide private]

__init__(self, *args, **kw)
(Constructor)

source code 

Initialise the exchange with an optional list of 'channels'.

If the optional 'limit' is specified, restrictions on the addition of
new channels can be enforced and observed through the 'add_wait', 'wait'
and 'finish' methods. To make use of these methods, create a subclass of
this class and define a working 'store_data' method.

If the optional 'reuse' parameter is set to a true value, channels and
processes will be reused for waiting computations.

If the optional 'autoclose' parameter is set to a false value, channels
will not be closed automatically when they are removed from the exchange
- by default they are closed when removed.

Overrides: Exchange.__init__
(inherited documentation)

add(self, channel)

source code 
Add the given 'channel' to the exchange.

Overrides: Exchange.add

start(self, callable, *args, **kw)

source code 

Using pprocess.start, create a new process for the given 'callable'
using any additional arguments provided. Then, monitor the channel
created between this process and the created process.

Overrides: Exchange.start

create(self)

source code 

Using pprocess.create, create a new process and return the created
communications channel to the created process. In the creating process,
return None - the channel receiving data from the created process will
be automatically managed by this exchange.

Overrides: Exchange.create

store_data(self, channel)

source code 
Accumulate the incoming data, associating results with channels.

Overrides: Exchange.store_data