/usr/share/doc/python-nwsclient/examples/parallel.py is in python-nwsclient 1.6.4-8build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 | #!/usr/bin/env python
import sys, os, time
import nws.client, nws.sleigh
import worker
wsname, host, port = 'foo', 'localhost', 8765
ws = nws.client.NetWorkSpace(wsname, host, port)
verbose = 1
scriptDir = None
if len(sys.argv) > 1:
scriptDir = sys.argv[1]
print "using scriptDir =", scriptDir
s = nws.sleigh.Sleigh(scriptDir=scriptDir, verbose=verbose)
p = s.eachWorker(worker.worker, wsname, host, port, blocking=False)
try:
s.eachWorker(worker.worker, wsname, host, port, blocking=False)
print "Error: should have generated a SleighOccupiedException"
except:
print "Success"
r = p.wait()
print "Results from execution 1:", r
r = s.eachWorker(worker.worker, wsname, host, port)
print "Results from execution 2:", r
r = s.eachWorker(worker.worker, wsname, host, port)
print "Results from execution 3:", r
r = s.eachWorker(worker.worker, wsname, host, port)
print "Results from execution 4:", r
r = s.eachWorker(worker.worker, wsname, host, port)
print "Results from execution 5:", r
print "Loop over about 1 minute of work"
for i in xrange(60):
r = s.eachWorker(time.sleep, 1)
print "Variable listing:"
print ws.listVars(),
s.stop()
|