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,
|
||||
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',
|
||||
type="int", dest="port", default=6666,
|
||||
help="specify the port to use on the server (default: %default)")
|
||||
@ -55,7 +59,8 @@ if __name__ == '__main__':
|
||||
|
||||
tasksq, resultsq, masterq, slavesq = get_qs(m)
|
||||
|
||||
print "wait on all participants"
|
||||
if not options.participants:
|
||||
print "wait on all announced participants"
|
||||
participants = 0
|
||||
while not masterq.empty():
|
||||
participants += 1
|
||||
@ -64,6 +69,12 @@ if __name__ == '__main__':
|
||||
if participants == 0:
|
||||
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 = []
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user