Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Remote Objects via CGI?

Reply
Thread Tools

Remote Objects via CGI?

 
 
kpd
Guest
Posts: n/a
 
      11-01-2006
Three are lots of good looking remote-object implementations for Python
such as Pyro, Rpyc, and PyInvoke. All of these require a deamon
running to serve the remote objects.

Has anyone seen a method of doing this using CGI or FastCGI instead of
a deamon? I'm not worried about performance for this application, but
I do have constraints on long-running processes.

I do want to stay away from XmlRpc if possible.

Do you have any suggestions?

 
Reply With Quote
 
 
 
 
Fredrik Lundh
Guest
Posts: n/a
 
      11-01-2006
kpd wrote:

> Has anyone seen a method of doing this using CGI or FastCGI instead of
> a deamon? I'm not worried about performance for this application, but
> I do have constraints on long-running processes.
>
> I do want to stay away from XmlRpc if possible.


because?

</F>

 
Reply With Quote
 
 
 
 
Diez B. Roggisch
Guest
Posts: n/a
 
      11-01-2006
kpd wrote:

> Three are lots of good looking remote-object implementations for Python
> such as Pyro, Rpyc, and PyInvoke. All of these require a deamon
> running to serve the remote objects.
>
> Has anyone seen a method of doing this using CGI or FastCGI instead of
> a deamon? I'm not worried about performance for this application, but
> I do have constraints on long-running processes.


This is pretty much a contradiction to what pyro (the others I don't know,
but I bet they are similar) does: serve requests from in-memory living
stateful objects.

CGI on the other hand will spawn a new process for each request, discarding
quite a few aspects. You'd have to re-instantiate the serving objects for
each request, if you want to keep the statefulness, you have to persist
state between requests and ensure there is some session state communicated.

All in all, it can't be done so easily as by only adapting an existing
RPC-solution, but you rather should roll out your own. Or stick with what
is available, like XMLRPC

Diez
 
Reply With Quote
 
kpd
Guest
Posts: n/a
 
      11-01-2006
I did not have much hope, but thought there might be something. I was
thinking of going this route to get a very quick solution to a python
fat-client adding to or retrieving objects from a community repository
over http.

XMLRpc could work if there is a CGI solution, although the data sets do
not lend themselves to XML. They are tuples of 6 floats about 2000 to
a data set.

I did just find out today that CherryPy can support different apps in
'branches' so that may be the right way to go.

Might just have to do it the right way with a real CGI app.

 
Reply With Quote
 
Fredrik Lundh
Guest
Posts: n/a
 
      11-01-2006
kpd wrote:

> I did not have much hope, but thought there might be something. I was
> thinking of going this route to get a very quick solution to a python
> fat-client adding to or retrieving objects from a community repository
> over http.
>
> XMLRpc could work if there is a CGI solution, although the data sets do
> not lend themselves to XML. They are tuples of 6 floats about 2000 to
> a data set.


sounds like native HTTP plus mime/multipart messages is all you need.
just POST or GET to a CGI script, and use the email module to create and
pull apart the messages.

</F>

 
Reply With Quote
 
kpd
Guest
Posts: n/a
 
      11-01-2006
Thanks Fredrik. I gave XmlRpc a shot as you implied earlier.

It works like a charm. This is how I tested quickly locally without a
large web-server installed:

1. Run cgiserver.py - this takes the place of the normal web server.
2. Then run test.py to make a local xmlrpc call.


../cgi-bin/xmlrpcserver.py:
from SimpleXMLRPCServer import CGIXMLRPCRequestHandler
def test( theList ):
return len(theList)

server = CGIXMLRPCRequestHandler()
server.register_function(test)
server.handle_request()

../test.py:
from xmlrpclib import ServerProxy, Error
server = ServerProxy("http://localhost:8080/cgi-bin/xmlrpcserver.py")
theList = [ 1.1, 2.2, 3.3, 4.4 ]
print server.test( theList )

../cgiserver.py:
from BaseHTTPServer import HTTPServer
from CGIHTTPServer import CGIHTTPRequestHandler
serv = HTTPServer(("", 8080), CGIHTTPRequestHandler)
serv.serve_forever()


The code comes from a the python docs and an old list message at
http://mail.python.org/pipermail/tut...ry/003142.html

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OT: How to reboot remote PC via VPN/Remote Desktop? (PeteCresswell) Wireless Networking 9 02-08-2013 02:18 PM
class objects, method objects, function objects 7stud Python 11 03-20-2007 06:05 PM
[ANN] Roxy 0.1 - Remote Proxy Objects w/ type & method signature impersonation and w/ remote block yields. Jeff Wood Ruby 7 10-18-2005 06:51 AM
Remote Assistance fails to connect, remote remote host name could not be resolved Peter Sale Wireless Networking 1 12-11-2004 09:09 PM
Difference between Remote Desktop and Remote Desktop for Admin Dave Marden MCSE 16 01-24-2004 12:47 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57