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
1 changed files with 7 additions and 9 deletions

View File

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