Async XMLRPC and job processing

Sean Davis seandavi at gmail.com
Wed Oct 17 16:53:26 EDT 2007


I would like to set up a server that takes XMLRPC requests and
processes them asynchronously.  The XMLRPC server part is trivial in
python.  The job processing part is the part that I am having trouble
with.  I have been looking at how to use threadpool, but I can't see
how to get that working.  I would like to have the XMLRPC part of
things do something like:

def method1(a,b,c):
    jobid=workRequest(long_method1,[a,b,c])
    return(jobid)

def method2(a,b,c):
    jobid=workRequest(long_method2,[a,b,c])
    return(jobid)

def long_method1(a,b,c)
    do lots of heavy computation, etc.
    store results in files in a given directory, etc
    return result

.... for any number of methods

Again, pretty straightforward.  However, I run into problems with the
threadpool and xmlrpc server both waiting.  In particular, if I do
something like:

server = SimpleXMLRPCServer.SimpleXMLRPCServer(.....)
server.serve_forever()

Where can tell the threadpool that I have set up to wait
indefinitely?  Both are blocking.

Thanks,
Sean




More information about the Python-list mailing list