passing data to a daemon

Rob Hunter rob at cs.brown.edu
Sat Oct 4 17:51:45 EDT 2003


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