added watch-like functionality to iqmgr.py, but it seems to break the server

This commit is contained in:
Stephen McQuay 2011-05-24 13:45:08 -06:00
parent ca49c7eec7
commit 9d85053b0e

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python
import sys
import time
import interp.bootstrap
from interp.cluster import QueueManager, get_qs
@ -20,6 +21,24 @@ if sys.argv[1].startswith("st"):
print " masterq : %d" % mq.qsize()
print " minionsq : %d" % sq.qsize()
if sys.argv[1].startswith("wa"):
if len(sys.argv) == 3:
sleeptime = float(sys.argv[2])
else:
sleeptime = 1
i = 0
while True:
time.sleep(sleeptime)
if i % 20 == 0:
print "tasksq resultsq masterq minionsq"
print "%d %d %d %d" % \
(tq.qsize(),
rq.qsize(),
mq.qsize(),
sq.qsize(),)
i += 1
if sys.argv[1] == 'add':
for i in xrange(int(sys.argv[2])):
mq.put('jane')
@ -31,7 +50,7 @@ if sys.argv[1] == 'slay':
sq.put("slay")
elif len(sys.argv) == 3:
for i in xrange(int(sys.argv[2])):
print i, "killing ... jane?"
print i, "killing", mq.get()
sq.put("slay")