port rqinfo to py3

main
Alex Morega 12 years ago
parent 8d61d3bf26
commit 5b630b1e22

@ -101,9 +101,9 @@ def show_workers(args):
for w in ws:
worker_queues = filter_queues(w.queue_names())
if not args.raw:
print '%s %s: %s' % (w.name, state_symbol(w.state), ', '.join(worker_queues))
print('%s %s: %s' % (w.name, state_symbol(w.state), ', '.join(worker_queues)))
else:
print 'worker %s %s %s' % (w.name, w.state, ','.join(worker_queues))
print('worker %s %s %s' % (w.name, w.state, ','.join(worker_queues)))
else:
# Create reverse lookup table
queues = dict([(q, []) for q in qs])
@ -119,21 +119,21 @@ def show_workers(args):
queues_str = ", ".join(sorted(map(lambda w: '%s (%s)' % (w.name, state_symbol(w.state)), queues[q])))
else:
queues_str = ''
print '%s %s' % (pad(q.name + ':', max_qname + 1), queues_str)
print('%s %s' % (pad(q.name + ':', max_qname + 1), queues_str))
if not args.raw:
print '%d workers, %d queues' % (len(ws), len(qs))
print('%d workers, %d queues' % (len(ws), len(qs)))
def show_both(args):
show_queues(args)
if not args.raw:
print ''
print('')
show_workers(args)
if not args.raw:
print ''
print('')
import datetime
print 'Updated: %s' % datetime.datetime.now()
print('Updated: %s' % datetime.datetime.now())
def parse_args():
@ -186,5 +186,5 @@ def main():
print(e)
sys.exit(1)
except KeyboardInterrupt:
print
print()
sys.exit(0)

@ -21,7 +21,7 @@ from .logutils import setup_loghandlers
from .exceptions import NoQueueError, UnpickleError, DequeueTimeout
from .timeouts import death_penalty_after
from .version import VERSION
from rq.compat import text_type
from rq.compat import text_type, as_text
green = make_colorizer('darkgreen')
yellow = make_colorizer('darkyellow')
@ -68,7 +68,7 @@ class Worker(object):
if connection is None:
connection = get_current_connection()
reported_working = connection.smembers(cls.redis_workers_keys)
workers = [cls.find_by_key(key, connection) for key in
workers = [cls.find_by_key(as_text(key), connection) for key in
reported_working]
return compact(workers)
@ -91,7 +91,7 @@ class Worker(object):
name = worker_key[len(prefix):]
worker = cls([], name, connection=connection)
queues = connection.hget(worker.key, 'queues')
queues = as_text(connection.hget(worker.key, 'queues'))
worker._state = connection.hget(worker.key, 'state') or '?'
if queues:
worker.queues = [Queue(queue, connection=connection)

Loading…
Cancel
Save