On Jan 21, 9:03 am, Adam Tauno Williams <awill...@opengroupware.us> wrote: > 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 > <http://coils.hg.sourceforge.net/hgweb/coils/coils/file/2c7847ef0527/s...> > 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 > <http://coils.hg.sourceforge.net/hgweb/coils/coils/file/2c7847ef0527/s...>. > Then implementing a new service [type of worker] is as easy as (our brutally > simple pubsub service) > <http://coils.hg.sourceforge.net/hgweb/coils/coils/file/2c7847ef0527/s...> > > Hope that helps. >
It does indeed! I'm gonna try this approach for now. -- http://mail.python.org/mailman/listinfo/python-list