[Pympi-users] Reposted: Web Services and pyMPI:
Status: Alpha
Brought to you by:
patmiller
From: Julian C. <rjc...@cs...> - 2005-08-02 02:22:19
|
(This ended up at the end of the pyMPI 2.4 beta 2 available.... thread, so I reposted it as a new thread here) Web Services and pyMPI: Recently (that would be this w/e) I looked at how to set up a web service in python. The major reason was to make code written on python available from other platforms, especially Windows and Excel. I installed SOAPpy 0.12 (http://pywebsvcs.sourceforge.net/) on both windows and Solaris and suffice to say, it"s very easy to use python client to python server. SOAPpy handles all the complexity for you. The real complexity was having to use WSDL descriptor files to be able to call python servers from Excel (Using MS SoapClient 3.0). Basically on Windows, you have? to use a WSDL and you need to use namespaces or it doesn"t work. Effectively, you have to pre-define all functions, inputs and outputs in the WSDL file. Now to the point: You probably aren"t shocked to find out that I was able to get pyMPI to act as a soap server. My reasoning was simple: why wait 10 seconds to run something on windows, when I can run the same thing in 1 second on pyMPI? Below is a simple example of pyMPI running at np 1, generating and returning a short array of random numbers to a soap client. The printout is from the client side. Issues: The major issue that occurs to me regarding pyMPI is that most parallel scripts are by nature long running processes. This conflicts with the nature of a server, which is supposed to handle multiple clients and multiple tasks simultaneously. This suggests that the server itself would have to either queue requests or manage the slave processes. That seems to add a lot of complexity. Anyway let me know if you think it has any utility for you. regards Julian Cook >>> # Call a pyMPI soap server >>> import SOAPpy >>> server = SOAPpy.SOAPProxy("http://brahma:8007/",namespace = "python-os") >>> seed = 69069 >>> server.config.dumpSOAPIn = 1 # debugging flag >>> list = server.ArrayOfFloats(seed) *** Incoming SOAP ****************************************************** <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" > <SOAP-ENV:Body> <ArrayOfFloatsResponse SOAP-ENC:root="1"> <Result SOAP-ENC:arrayType="xsd:double[10]" xsi:type="SOAP-ENC:Array"> <item>0.70316610192589002</item> <item>0.37607240403594255</item> <item>0.018328414124517245</item> <item>0.87040174120950486</item> <item>0.20098065818385713</item> <item>0.52939641382095703</item> <item>0.68237564433556841</item> <item>0.076620094609716638</item> <item>0.50193267461011581</item> <item>0.53994633368761047</item> </Result> </ArrayOfFloatsResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope> ************************************************************************ |