mirror of
https://github.com/django-q2/django-q2.git
synced 2026-09-24 13:18:11 +08:00
23 lines
661 B
Python
23 lines
661 B
Python
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
|
|
|
|
|
|
class Command(BaseCommand):
|
|
# Translators: help text for qmonitor management command
|
|
help = _("Monitors Q Cluster activity")
|
|
|
|
option_list = BaseCommand.option_list + (
|
|
make_option('--run-once',
|
|
action='store_true',
|
|
dest='run_once',
|
|
default=False,
|
|
help='Run once and then stop.'),
|
|
)
|
|
|
|
def handle(self, *args, **options):
|
|
monitor(run_once=options.get('run_once', False))
|