Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python XMLRPC with concurrent requests

Tags:

python

xml-rpc

I'm looking for a way to prevent multiple hosts from issuing simultaneous commands to a Python XMLRPC listener. The listener is responsible for running scripts to perform tasks on that system that would fail if multiple users tried to issue these commands at the same time. Is there a way I can block all incoming requests until the single instance has completed?

like image 785
MattB Avatar asked Oct 19 '09 14:10

MattB


1 Answers

I think python SimpleXMLRPCServer module is what you want. I believe the default behavior of that model is blocking new requests when current request is processing. The default behavior gave me lots of trouble and I changed that behavior by mix in ThreadingMixIn class so that my xmlrpc server could respond multiple requests in the same time.

class RPCThreading(SocketServer.ThreadingMixIn, SimpleXMLRPCServer.SimpleXMLRPCServer):
    pass

If I understand your question correctly, SimpleXMLRPCServer is the solution. Just use it directly.

like image 171
LNK2019 Avatar answered Sep 16 '22 20:09

LNK2019