made it so that one can persist the slaves

This commit is contained in:
Stephen McQuay 2011-03-30 21:34:44 -06:00
parent 2c13ec8c4c
commit d761bfceba

View File

@ -16,6 +16,16 @@ class QueueManager(BaseManager): pass
QueueManager.register('get_inqueue' )
QueueManager.register('get_outqueue')
def work(inq, outq, g):
outq.put((myname, "ready"))
while True:
i, o, e, X = inq.get()
if i == None:
break
a = g.run_baker(X, order = o, extra_points = e)
outq.put((i, myname, a['qlin'], a['error'], a['final'], exact(X)))
if __name__ == '__main__':
parser = OptionParser(usage = "usage: %s [options] <server> <gmsh file>")
@ -29,12 +39,12 @@ if __name__ == '__main__':
help="specify the port to use on the server (default: %default)")
(options, args) = parser.parse_args()
if len(args) != 2:
parser.print_usage()
sys.exit(1)
server, input_file = args
myname = options.label
m = QueueManager(address=(server, options.port), authkey='asdf')
m.connect()
@ -45,13 +55,7 @@ if __name__ == '__main__':
g = ggrid(input_file)
g.q = np.array([exact(x) for x in g.verts])
outq.put((myname, "ready"))
while True:
i, o, e, X = inq.get()
if i == None:
break
a = g.run_baker(X, order = o, extra_points = e)
outq.put((i, myname, a['qlin'], a['error'], a['final'], exact(X)))
work(inq, outq, g)
myname = options.label
print "%s finished" % myname