made the master count how many participants have announced themselves

This commit is contained in:
Stephen McQuay 2011-04-02 01:21:43 -06:00
parent 372fa346e0
commit 0f5356867d

View File

@ -43,7 +43,7 @@ if __name__ == '__main__':
help="shelve output file (default: %default)") help="shelve output file (default: %default)")
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
if len(args) != 3: if len(args) != 2:
parser.print_usage() parser.print_usage()
sys.exit(1) sys.exit(1)
@ -56,14 +56,14 @@ if __name__ == '__main__':
tasksq, resultsq, masterq, slavesq = get_qs(m) tasksq, resultsq, masterq, slavesq = get_qs(m)
print "wait on all participants" print "wait on all participants"
for i in xrange(participants):
participants = 0 participants = 0
while not masterq.empty(): while not masterq.empty():
participants += 1: participants += 1
worker = masterq.get() worker = masterq.get()
print "%d: %s is ready" % (participants - 1, worker) print "%d: %s is ready" % (participants, worker)
if participants == 0:
print "everyone ready!" print "nobody found"
sys.exit(1)
results = [] results = []
@ -74,7 +74,7 @@ if __name__ == '__main__':
submit_end = time.time() submit_end = time.time()
for i in xrange(participants): for i in xrange(participants):
print "sending %d th start message" % i print "sending worker %d start message" % (i+1,)
slavesq.put("start") slavesq.put("start")
receive_start = time.time() receive_start = time.time()
@ -94,8 +94,6 @@ if __name__ == '__main__':
for i in xrange(participants): for i in xrange(participants):
if options.last: if options.last:
slavesq.put("teardown") slavesq.put("teardown")
else:
slavesq.put("prepare for more")
# post processing # post processing
stats = {} stats = {}