|
|
@ -4,10 +4,11 @@ import sys
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import time
|
|
|
|
import time
|
|
|
|
import argparse
|
|
|
|
import argparse
|
|
|
|
import redis
|
|
|
|
|
|
|
|
from redis.exceptions import ConnectionError
|
|
|
|
from redis.exceptions import ConnectionError
|
|
|
|
from rq import use_connection, Queue, Worker
|
|
|
|
from rq import Queue, Worker
|
|
|
|
from rq.utils import gettermsize, make_colorizer
|
|
|
|
from rq.utils import gettermsize, make_colorizer
|
|
|
|
|
|
|
|
from rq.scripts import add_standard_arguments
|
|
|
|
|
|
|
|
from rq.scripts import setup_redis
|
|
|
|
|
|
|
|
|
|
|
|
red = make_colorizer('darkred')
|
|
|
|
red = make_colorizer('darkred')
|
|
|
|
green = make_colorizer('darkgreen')
|
|
|
|
green = make_colorizer('darkgreen')
|
|
|
@ -133,9 +134,7 @@ def show_both(args):
|
|
|
|
|
|
|
|
|
|
|
|
def parse_args():
|
|
|
|
def parse_args():
|
|
|
|
parser = argparse.ArgumentParser(description='RQ command-line monitor.')
|
|
|
|
parser = argparse.ArgumentParser(description='RQ command-line monitor.')
|
|
|
|
parser.add_argument('--host', '-H', default='localhost', help='The Redis hostname (default: localhost)')
|
|
|
|
add_standard_arguments(parser)
|
|
|
|
parser.add_argument('--port', '-p', type=int, default=6379, help='The Redis portnumber (default: 6379)')
|
|
|
|
|
|
|
|
parser.add_argument('--db', '-d', type=int, default=0, help='The Redis database (default: 0)')
|
|
|
|
|
|
|
|
parser.add_argument('--path', '-P', default='.', help='Specify the import path.')
|
|
|
|
parser.add_argument('--path', '-P', default='.', help='Specify the import path.')
|
|
|
|
parser.add_argument('--interval', '-i', metavar='N', type=float, default=2.5, help='Updates stats every N seconds (default: don\'t poll)')
|
|
|
|
parser.add_argument('--interval', '-i', metavar='N', type=float, default=2.5, help='Updates stats every N seconds (default: don\'t poll)')
|
|
|
|
parser.add_argument('--raw', '-r', action='store_true', default=False, help='Print only the raw numbers, no bar charts')
|
|
|
|
parser.add_argument('--raw', '-r', action='store_true', default=False, help='Print only the raw numbers, no bar charts')
|
|
|
@ -163,9 +162,7 @@ def main():
|
|
|
|
if args.path:
|
|
|
|
if args.path:
|
|
|
|
sys.path = args.path.split(':') + sys.path
|
|
|
|
sys.path = args.path.split(':') + sys.path
|
|
|
|
|
|
|
|
|
|
|
|
# Setup connection to Redis
|
|
|
|
setup_redis(args)
|
|
|
|
redis_conn = redis.Redis(host=args.host, port=args.port, db=args.db)
|
|
|
|
|
|
|
|
use_connection(redis_conn)
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if args.only_queues:
|
|
|
|
if args.only_queues:
|
|
|
|
func = show_queues
|
|
|
|
func = show_queues
|
|
|
@ -177,6 +174,3 @@ def main():
|
|
|
|
interval(args.interval, func, args)
|
|
|
|
interval(args.interval, func, args)
|
|
|
|
except ConnectionError as e:
|
|
|
|
except ConnectionError as e:
|
|
|
|
print(e)
|
|
|
|
print(e)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
|
|
main()
|
|
|
|
|