added slave code
This commit is contained in:
parent
6e4d8c9505
commit
dbe981c24b
32
bin/slave.py
Normal file
32
bin/slave.py
Normal file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
from multiprocessing.managers import BaseManager
|
||||
|
||||
import interp.bootstrap
|
||||
from interp.grid.gmsh import gmsh_grid3D
|
||||
|
||||
class QueueManager(BaseManager): pass
|
||||
QueueManager.register('get_inqueue' )
|
||||
QueueManager.register('get_outqueue')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) != 2:
|
||||
print >> sys.stderr, "usage: %s <gmsh file>" % sys.argv[0]
|
||||
sys.exit(1)
|
||||
m = QueueManager(address=('install', 50000), authkey='asdf')
|
||||
m.connect()
|
||||
|
||||
inq = m.get_inqueue()
|
||||
outq = m.get_outqueue()
|
||||
|
||||
g = gmsh_grid3D(sys.argv[1])
|
||||
|
||||
while True:
|
||||
id, X = inq.get()
|
||||
print id, X
|
||||
|
||||
for i in xrange(10):
|
||||
outq.put("hello from slave %d" % i)
|
Loading…
Reference in New Issue
Block a user