adds qinfo management command

It seems more practical to give this its own command instead of `qmonitor --info`
This commit is contained in:
Ilan
2015-08-10 13:20:17 +02:00
parent 63030aa9d1
commit e86308b434
5 changed files with 22 additions and 15 deletions
+12
View File
@@ -0,0 +1,12 @@
from django.core.management.base import BaseCommand
from django.utils.translation import ugettext as _
from django_q.monitor import info
class Command(BaseCommand):
# Translators: help text for qinfo management command
help = _('General information over all clusters.')
def handle(self, *args, **options):
info()
+2 -12
View File
@@ -1,10 +1,9 @@
# Django
from optparse import make_option
from django.core.management.base import BaseCommand
from django.utils.translation import ugettext as _
from django_q.monitor import monitor, info
from django_q.monitor import monitor
class Command(BaseCommand):
@@ -17,16 +16,7 @@ class Command(BaseCommand):
dest='run_once',
default=False,
help='Run once and then stop.'),
make_option('-i', '--info',
action='store_true',
dest='info',
default=False,
help='Lists general information over all clusters. ')
)
def handle(self, *args, **options):
if options.get('info', False):
info()
else:
monitor(run_once=options.get('run_once', False))
monitor(run_once=options.get('run_once', False))
+1 -1
View File
@@ -201,7 +201,7 @@ def info(r=redis_client):
reincarnations += cluster.reincarnations
term.clear_eos()
col_width = int(term.width / 6)
print(term.black_on_green(term.center(_('-- {} clusters summary --').format(Conf.PREFIX))))
print(term.black_on_green(term.center(_('-- {} summary --').format(Conf.PREFIX))))
print(term.cyan(_('Clusters')) +
term.move_x(1 * col_width) +
term.white(str(clusters)) +
+6 -1
View File
@@ -6,7 +6,12 @@ from django.core.management import call_command
def test_qcluster():
call_command('qcluster', run_once=True)
@pytest.mark.django_db
def test_qmonitor():
call_command('qmonitor', run_once=True)
call_command('qmonitor', info=True)
@pytest.mark.django_db
def test_qinfo():
call_command('qinfo')
+1 -1
View File
@@ -2,7 +2,7 @@ import pytest
import redis
from django_q.cluster import Cluster
from django_q.monitor import monitor, Stat, info, ping_redis
from django_q.monitor import monitor, Stat, ping_redis
def test_monitor():