passing data to a daemon

Eugene Oden goden at simplified.com
Sat Oct 4 19:35:40 EDT 2003


there are a number of ways you could do this, ranging from sending a message
to the daemon over a socket (probably using the select() function) or using
a higher layer remote method invocation or object broker library.  the
twisted project (http://www.twistedmatrix.com/) seems to provide some
useful utilities for this.  others you might consider are zope
(http://www.zope.org) or pyro (http://pyro.sourceforge.net).  i don't have
much experience with any of these but hopefully you'll find something
useful.

later,

gene

Rob Hunter wrote:

> Hi all.
> 
> I want to run a Python daemon that manages a "to-do" queue.  I want it
> so that the daemon is always running, where its running consists of
> looking at the queue to see if it has any jobs, and if it does, remove
> the job from the queue and "do the job".
> 
> This all seems quite doable using the synchronized Queue.py module and
> this page
> (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66012) which
> describes writing a daemon in Python.
> 
> My problem is: how will I submit jobs to the queue?  The issue is that
> jobs are generated by users of, say, the operating system, so they
> aren't a part of the daemon process.  Ideally, I want a way of making a
> function call to the daemon process *from outside the daemon process*.
> 
> For example, say my daemon has the function in it "addToQueue".  I'd
> like to write a totally separate piece of Python code that calls this
> function inside the *running* daemon.
> 
> I suppose I could use files with locking as an interface, but there's
> got to be a better way.
> 
> Thanks for any tips,
> 
> Rob





More information about the Python-list mailing list