SimpleXMLRPCServer and forking
Chuck May
NmOaSyPcAM at imsweb.com
Wed Jan 22 18:19:29 EST 2003
I have a couple of questions concerning the SimpleXMLRPCServer.
1. I'm trying to implement a situation where the web client makes a call
to the XML-RPC server, a database is updated showing that a job is
beginning to run, and the server returns success to the calling user.
After the request completes, the job (which takes a long time) starts to
run and completes. Upon completion, the results are posted into the
database. Here is some very simple code that illistates what I am
talking about:
import SimpleXMLRPCServer, sys, socket
class Functions:
def _logon(self, user, db):
# handle user verification
def dump(self, user, db, request):
_logon(user, db)
# return success
# continue long running request
if __name__ == '__main__':
server = SimpleXMLRPCServer.SimpleXMLRPCServer((localhost, 8000))
server.register_instance(Functions())
server.serve_forever()
Does anyone know the best way to handle that? Should I use a fork() in
the dump function? I'm not sure how that will affect the XML-RPC server
though. I could call an external program and launch it as a background
process, but I'd like to keep the code self-contained.
2. Am I correct in saying that SimpleXMLRPCServer can only process a
single request at a time? It doesn't appear to be using the forking
model. If that is the case, does anyone know an easy way to create a
forking version? I could copy the source code and make some changes,
but I was wondering if there was a way to subclass instead.
Thanks for any help,
--
Chuck May
IMS, Inc.
NmOaSyPcAM at imsweb.com
More information about the Python-list
mailing list