Using win32api.GetTickCount() over the network
dave at pythonapocrypha.com
Wed Mar 5 21:37:42 CET 2003
On Wed, 5 Mar 2003, Donovan Hide wrote:
> is there a way to connect to a remote machine and use
> win32api.GetTickCount() call to measure how long a machine has been up, in a
> smilar way to the MS utility uptime.exe. Also does anyone know how to
> control services and processes on remote machines without using other .exe
> utilities such as those from sysinternals.
> I am writing a wxPython utility to monitor and control a 3d renderfarm
> and your assistance would be gratefully received.
Probably the easiest and most flexible thing to do is run a custom Python
"listener" on each machine in the render farm. Here's some untested code
On the listener size:
CMD_GET_TICKS = 1
import SocketServer, pickle
cmd = self.request.recv(1)
if cmd == CMD_GET_TICKS:
addr = ('10.20.30.5', 5000) # Listen on this address
server = SocketServer.ThreadingTCPServer(addr, Handler)
On the server side (your wxPython monitoring app):
import socket, cPickle
s = socket(AF_INET, SOCK_STREAM)
data = ''
more = s.recv(1024)
if not more: break
data += more
You can of course get much fancier by adding additional commands (kill the
render process, restart the render process, check free disk space, check
number of frames done, etc.) as well as adding the ability to send
parameters as part of the commands to the render nodes.
More information about the Python-list