Fog Creek Software
Discussion Board




Windows RPC question

I'm setting up a nightly build system with about 20 Windows XP machines, and I'm wondering how I can do some sort of remote procedure call thing.  I just want to call some code on another machine from a master machine, and possibly return a result (though even that is optional).  This is really really basic stuff, nothing fancy.

Right now there is some hack where the callees run a script that polls for a file to be renamed on a network share.  The master machine (caller) renames the file, then the callees see that, and execute the code that they're supposed to.

The build scripts are written in Python if that matters.  I was thinking about using Python XML-RPC but I think that would involve installing a web server on 20 machines, which I might want to avoid if possible -- if it can be done with a bare Windows XP installation.

I have googled and searched the MS website, and it does seem like there is some RPC mechanism built into Windows, but I cannot find any decent info about it.  All the google links are from like 1994 about Windows 3.1.  : )

If anyone could tell me how to execute a simple RPC call end-to-end on 2 Windows machines, I would greatly appreciate it.  Thanks.

Andy
Saturday, January 10, 2004

If you can get away without returning a result then you can use the NT shell command 'at' to schedule the job on the remote computers.

r1ch
Saturday, January 10, 2004

If you are happy using IIS then you already have a web server on each XP machine, or at least if you installed it at setup.

Matthew Lock
Saturday, January 10, 2004

If you can convince the owners of those machines to fall behind on their security patches, there's probably a couple of vunerabilities you could exploit...

http://www.securitytracker.com/alerts/2003/Jul/1007212.html

Tom H
Saturday, January 10, 2004

There's two options, really, short of setting up the web servers.

One is the traditional RPC mechanism, and the other is DCOM. They actually look pretty similar, but there's more available documentation on the DCOM path.

Brad Wilson (dotnetguy.techieswithcats.com)
Saturday, January 10, 2004

I second DCOM, it's incredibly easy and straightforward, though if you haven't used COM before you may want to look at other options first because there is a month or two learning curve to COM in general.

But basically all you do is use CoCreateInstanceEx (in C++) on the source machine and give it the remote machine's network name, and the remote component GUID, then it launches the desired .dll or .exe on the remote machine and sets up the link so to you it's just like making regular method calls.

Ron
Saturday, January 10, 2004

You didn’t offer too many details so the mileage can vary. I use a central MSSQL server to store commands and results. As a plus MSSQL has a nice scheduling mechanism. Both commands and results are handled by a web interface (ASP).  Using a Web interface allows everybody to issue commands and see the results as well. DCOM is too complex for this simple task in my opinion.

coresi
Saturday, January 10, 2004

Thanks for the responses... the at command is more along the lines of what I'm looking for I guess.  I haven't done COM, and there is no C++ in this program yet.  Too bad it doesn't look like the at command can wait for completion and get a return value, but I guess you can fake that by writing some sort of file to a network share when the child program is done.

Any other suggestions would be appreciated.  I still might go with Python XML-RPC, depending on what software you need to install... if anyone has used that on both client and server sides, I would appreciate hearing about it.

Andy
Saturday, January 10, 2004

Andy - the other option to signal completion is to have the remote machine schedule something back on the original machine when it has finished.

r1ch
Saturday, January 10, 2004

An old-fashioned way is to implement your own RPC using TCP: install some "server" software to listen on the remote machine (but you may need to make it a "service" not just an application, if it's to be run on the remote machine before anyone has logged in), when you want it to do something they you connect to it using "client" software.

You can send anything over the TCP connection (including a command formatted as XML), and return anything (including a result).

You'll need to put your server software on the remote machine, but it will be standalone (won't need an entire Web server as well).

http://heather.cs.ucdavis.edu/~matloff/Python/PyNet.pdf tells me that Python supports TCP.

Christopher Wells
Saturday, January 10, 2004

Sockets, SOAP, COM - all should work and as a guess they should be relatively available in Python.

Also look for a componentized web server. I know they're available. The nice thing about a web server is that 3/4 of your work is done for you (negotiation, responses, pro forms errors, authentication, encryption).

DCOM is pretty much COM over a wire, and I'd think Python can implement a COM sink, can't it?

This problem has been solved a lot - keep looking, you should be able to find a fairly established solution.

Philo

Philo
Saturday, January 10, 2004

Hm, I am a little confused, maybe I can clarify a little more.  I'm looking for the solution that:

1) requires the minimum of software installation on the bare Windows XP Pro machines (like just Python would be nice, since it's already on there)

2) requires the least amount of knowledge by me : )

3) Lets me simply call a remote (Python) function, wait for a return value and get it.  Or perhaps call a batch file with command line arguments, and get its return value (just an integer, I believe)

4) There is no performance requirement, as I will be making about 1 call every night : )

Out of all the solutions so far, I'm leaning toward the Windows at command, but it would be nice to have something cleaner.

Andy
Saturday, January 10, 2004

http://www.oreilly.com/catalog/pythonwin32/chapter/ch12.html

It seems that the Python interpreter can be registered as a DCOM object, so that you can invoke arbitrary Python command on a remote machine from a Python program running on the local machine.

Christopher Wells
Saturday, January 10, 2004

the simplest?
as people suggested, the at command. then send the results back to the master computer--write a file to a file share (simplest), call a web method (can even be get http://master/response?computer=3&result=74), schedule another command with at.

nothing need be installed on the slave computers, and very little (e.g. a file share or web server) on the master.

if in LA, use different terminology than master/slave.

mb
Saturday, January 10, 2004

I'm thinking you should make it asynchronous (in which case the AT command or a DCOM call would be very easy) - just rely on logging to determine what happened the next day.

You've got distributed computing, and calling methods synchronously gives up that advantage. If one machine hangs, you're done for the night. Instead, you fire off 18 (or however many) initiation commands, have each client write to a file share or database upon completion or error. The in the morning you simply check the results and bang on the machines that reported errors.

Philo

Philo
Saturday, January 10, 2004

Yeah I'm thinking I'm going to go with "at".  Thank you to everyone.

I do need to wait for certain processes to be done because of dependencies, but also I need to time out if one process fails, so the build can continue.

I think that the at command will do that -- except does anyone know if there is a syntax for the time to be "now"?

It seems to only want to schedule things at a specific time.  Of course I can hack it and get the current time through a script, but I don't want to deal with things like the system clock being wrong, or daylight savings happens and so it schedules a job before "now", etc.

Andy
Saturday, January 10, 2004

Try Pyro - Python Remote Objects.

  http://pyro.sourceforge.net/

It's robust, very simple to use and works very well for us in a 14-machine stress-test lab.  Each machine needs to run a Pyro server (Python script) and one machine needs to run a naming server.

regards,

Chris

Chris Newcombe
Saturday, January 10, 2004

If the requirement is the minimum amount of dependencies, you might want to use XMLRPC, with just a couple of routines on a web server, and a light-weight component on the client to make a call. You'll find implementations in either COM or Python here:

http://www.xmlrpc.com/directory/1568/implementations

Frederic Faure
Saturday, January 10, 2004

You can use soon.exe, part of the Windows resource kit, downloadable for free from the link below here to schedule things to run now (or at least soon) I think.  http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/soon-o.asp

r1ch
Sunday, January 11, 2004


Chris wrote above to try Pyro ( http://pyro.sourceforge.net ) I would second that ;-)
And, you don't need to run a Name Server (it's optional, to let you find your remote objects by name instead of hostname and object ID). Try it out. It only takes a few lines of code to call remote Python objects using Pyro.

Irmen de Jong
Thursday, January 22, 2004

*  Recent Topics

*  Fog Creek Home