Package grassyknoll :: Package concurrent :: Module ThreadPool :: Class BroadcastThreadPool
[hide private]

Class BroadcastThreadPool

source code


a ThreadPool with support for broadcasting a message to all workers

Nested Classes [hide private]
class _workerClass
class of Worker.Worker to create
Instance Methods [hide private]
 
parallelBroadcast(self, payload, timeout=None)
send payload to all workers in parallel Message.Messages
source code
 
serialBroadcast(self, payload, timeout=None, reply_box=None)
send payload to all workers in serial Message.Messages
source code

Inherited from ThreadPool: __init__, __repr__, aliveCount, join, start, stop

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

Class Methods [hide private]

Inherited from lib.meta.FactoryMixin: factory

Class Variables [hide private]

Inherited from ThreadPool: logger

Instance Variables [hide private]

Inherited from ThreadPool: inbox, name, workers

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

parallelBroadcast(self, payload, timeout=None)

source code 
send payload to all workers in parallel Message.Messages
Parameters:
  • payload (object) - an object to be wrapped in a Message.Message and sent to all workers. The object will be copy.copy'd for each message.

Note: this function does not check for replies

serialBroadcast(self, payload, timeout=None, reply_box=None)

source code 

send payload to all workers in serial Message.Messages

The function will wait for confirmation of each message before sending the next one. Replies will be discarded, though exceptions will be raised. Not all workers may receive a message if an exception occurs.
Parameters:
  • payload (object) - an object to be wrapped in a Message.Message and sent to all workers. The object will be copy.copy'd for each message.
  • timeout (float) - how long to wait for all replies, in seconds