simple pub/sub

Steve Howell showell30 at
Thu Jan 21 18:28:52 CET 2010

On Jan 21, 9:03 am, Adam Tauno Williams <awill... at>
> On Thu, 2010-01-21 at 08:54 -0800, Steve Howell wrote:
> > Hi, I'm looking for ideas on building a simple architecture that
> > allows a bunch of independent Python processes to exchange data using
> > files and perform calculations.
> > One Python program would be collecting data from boat instruments on a
> > serial port, then writing that info out to a file, and also
> > transmitting data to instruments as needed (again through the serial
> > port).  It would be the most complex program in terms of having to
> > poll file descriptors, or something similar, but I want to limit its
> > job to pure communication handling.
> This should be pretty easy using multiprocessing.  In OpenGroupware
> Coils we have a master process
> <> that spins up children (workers, that each provide a distinct service) it opens a Pipe to each child to send messages to the child and a Queue from which it reads [all children (clients) write to the Queue and listen on their Pipe].  Then the master just listens on its pipe and forwards messages from children to other children.
> All children are Service objects
> <>.  Then implementing a new service [type of worker] is as easy as (our brutally simple pubsub service) <>
> Hope that helps.

It does indeed!  I'm gonna try this approach for now.

More information about the Python-list mailing list