Files
django-q2/django_q/management/commands/qmonitor.py
T
Ilan 5a3f875baa Added management commands to tests
* added --run-once option to the management commands for testing
2015-07-16 15:17:15 +02:00

21 lines
660 B
Python

# Django
from django.core.management.base import BaseCommand
from django.utils.translation import ugettext as _
from django_q.monitor import monitor
class Command(BaseCommand):
# Translators: help text for qmonitor management command
help = _("Monitors Q Cluster activity")
def add_arguments(self, parser):
parser.add_argument('--run-once',
action='store_true',
dest='run_once',
default=False,
help='Run once and then exit.')
def handle(self, *args, **options):
monitor(run_once=options.get('run_once', False))