From 0f5356867de828474e3ab10a1639a76fff183723 Mon Sep 17 00:00:00 2001 From: Stephen Mardson McQuay Date: Sat, 2 Apr 2011 01:21:43 -0600 Subject: [PATCH] made the master count how many participants have announced themselves --- bin/master.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/bin/master.py b/bin/master.py index fd45bc3..dd048a5 100644 --- a/bin/master.py +++ b/bin/master.py @@ -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 = {}