made it update the masterq only if the master told it to die

This commit is contained in:
Stephen McQuay 2011-04-02 01:20:59 -06:00
parent 36ba080d14
commit 1e612ca070
2 changed files with 7 additions and 3 deletions

View File

@ -20,10 +20,10 @@ if sys.argv[1].startswith("st"):
print " masterq : %d" % mq.qsize() print " masterq : %d" % mq.qsize()
print " slavesq : %d" % sq.qsize() print " slavesq : %d" % sq.qsize()
if sys.argv[1] == 'teardown': if sys.argv[1] == 'slay':
for i in xrange(mq.qsize()): for i in xrange(mq.qsize()):
print i, "killing", mq.get() print i, "killing", mq.get()
sq.put("teardown") sq.put("slay")
if sys.argv[1] == 'clear': if sys.argv[1] == 'clear':
for i in xrange(tq.qsize()): print tq.get() for i in xrange(tq.qsize()): print tq.get()

View File

@ -55,13 +55,17 @@ if __name__ == '__main__':
if options.verbose: if options.verbose:
print myname print myname
while True: while True:
# indicate that I am loaded up, and ready for workload # indicate that I am loaded up, and ready for workload
masterq.put(myname) masterq.put(myname)
# wait for master's start signal # wait for master's start signal
action = slavesq.get() action = slavesq.get()
if action == "teardown": if action == "teardown":
# I take it back; I'm not ready!
masterq.get()
break
elif action == "slay":
break break
while not tasksq.empty(): while not tasksq.empty():