made it so that one can persist the slaves
This commit is contained in:
parent
2c13ec8c4c
commit
d761bfceba
22
bin/slave.py
22
bin/slave.py
@ -16,6 +16,16 @@ class QueueManager(BaseManager): pass
|
|||||||
QueueManager.register('get_inqueue' )
|
QueueManager.register('get_inqueue' )
|
||||||
QueueManager.register('get_outqueue')
|
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__':
|
if __name__ == '__main__':
|
||||||
parser = OptionParser(usage = "usage: %s [options] <server> <gmsh file>")
|
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)")
|
help="specify the port to use on the server (default: %default)")
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
if len(args) != 2:
|
if len(args) != 2:
|
||||||
parser.print_usage()
|
parser.print_usage()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
server, input_file = args
|
server, input_file = args
|
||||||
myname = options.label
|
|
||||||
|
|
||||||
m = QueueManager(address=(server, options.port), authkey='asdf')
|
m = QueueManager(address=(server, options.port), authkey='asdf')
|
||||||
m.connect()
|
m.connect()
|
||||||
@ -45,13 +55,7 @@ if __name__ == '__main__':
|
|||||||
g = ggrid(input_file)
|
g = ggrid(input_file)
|
||||||
g.q = np.array([exact(x) for x in g.verts])
|
g.q = np.array([exact(x) for x in g.verts])
|
||||||
|
|
||||||
outq.put((myname, "ready"))
|
work(inq, outq, g)
|
||||||
|
|
||||||
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)))
|
|
||||||
|
|
||||||
|
myname = options.label
|
||||||
print "%s finished" % myname
|
print "%s finished" % myname
|
||||||
|
Loading…
Reference in New Issue
Block a user