Python & RabbitMQ -- Communicate Between Parent & Children?
I'd like to write a python
script (call it parent) that does the following:
(1) defines a multi-dimensional numpy
array
(2) forks
10 different python
scripts (call them children开发者_如何学Python). Each of them must be able to read
the contents of the numpy
array from (1) at any single point in time (as long as they are alive).
(3) each of the child scripts will do its own work (children DO NOT share any info with each other)
(4) at any point in time, the parent script must be able to accept messages from all of its children. These messages will be parsed by the parent and cause the numpy
array from (1) to change.
How do I go about this, when working in python
in a Linux
environment? I thought of using rabbitMQ
and have the parent be a producer (of the numpy
array) to its children. On the other hand, each child must be able to transmit messages to the parent.
Which rabbitMQ
model is most suitable for this?
'Global Arrays' might be what you need.
Check it out, second talk: http://blip.tv/pycon-us-videos-2009-2010-2011/pycon-2011-friday-afternoon-lightning-talks-4902699
精彩评论