[Twisted-Python] Transparent Remote Objects
justinjohnson at fastmail.fm
Fri May 16 11:23:12 EDT 2003
I have a bunch of servers I have to support and I want to be able to
connect remotely to the servers to run commands. I actually got this
working by taking the pbsimple.py example and adding the remote methods I
want and then creating a command-line tool to interact with the service.
It works great!
However, I have some commands that require a command to be run on one
machine (exporting a packet) and then connecting remotely to another
machine to complete the operation (importing a packet). Adding callbacks
to Deffereds looks a little cumbersome and makes it harder to read the
code. Is there a way to make this more transparent? Like Defining
Remote objects that can have methods called on them? I'm picture
something like the following, on a high level. VOB is just a repository
I create on one machine and then export to multiple sites where I have to
start_site = "some_site" # The place where the original VOB will be
sites = ["site1","site2","site3"]
for tag in vobs:
v = RemoteVOB(tag,start_site)
v.make() # Runs a command to create the VOB
for s in sites:
v.export(s) # Creates a packet and exports it to the destination
rv = RemoteVOB(tag,s) # Creates a remote object at the
rv.import() # Import the packet, completing the creation of the
Is there anything in twisted that works this way? If not, does anyone
have any suggestions on how to simplify the callback coding? I'm pretty
new to this and my understanding of what's going on under the covers is
I must say though, it was exceptionally easy to take the pbsimple example
and create a tremendously useful service to simplify administration.
This is some cool stuff!
More information about the Twisted-Python