made the master's participant count an optional parameter
This commit is contained in:
parent
0f5356867d
commit
d61a9dadba
@ -26,6 +26,10 @@ if __name__ == '__main__':
|
|||||||
action="store_true", dest="last", default=False,
|
action="store_true", dest="last", default=False,
|
||||||
help="when finished, send shutdown signal to connected nodes (default: %default)")
|
help="when finished, send shutdown signal to connected nodes (default: %default)")
|
||||||
|
|
||||||
|
parser.add_option('-n', '--node-count',
|
||||||
|
type="int", dest="participants", default=None,
|
||||||
|
help="specify how many participants we should wait for (default: %default)")
|
||||||
|
|
||||||
parser.add_option('-p', '--port',
|
parser.add_option('-p', '--port',
|
||||||
type="int", dest="port", default=6666,
|
type="int", dest="port", default=6666,
|
||||||
help="specify the port to use on the server (default: %default)")
|
help="specify the port to use on the server (default: %default)")
|
||||||
@ -55,15 +59,22 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
tasksq, resultsq, masterq, slavesq = get_qs(m)
|
tasksq, resultsq, masterq, slavesq = get_qs(m)
|
||||||
|
|
||||||
print "wait on all participants"
|
if not options.participants:
|
||||||
participants = 0
|
print "wait on all announced participants"
|
||||||
while not masterq.empty():
|
participants = 0
|
||||||
participants += 1
|
while not masterq.empty():
|
||||||
worker = masterq.get()
|
participants += 1
|
||||||
print "%d: %s is ready" % (participants, worker)
|
worker = masterq.get()
|
||||||
if participants == 0:
|
print "%d: %s is ready" % (participants, worker)
|
||||||
print "nobody found"
|
if participants == 0:
|
||||||
sys.exit(1)
|
print "nobody found"
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
participants = options.participants
|
||||||
|
print "wait on %d participants" % participants
|
||||||
|
for i in xrange(participants):
|
||||||
|
worker = masterq.get()
|
||||||
|
print "%d of %d: %s is ready" % (i+1, participants, worker)
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user