mirror of
https://github.com/django-q2/django-q2.git
synced 2026-09-15 13:37:56 +08:00
22 lines
609 B
Python
22 lines
609 B
Python
from django.core.management.base import BaseCommand
|
|
from django.utils.translation import gettext 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 stop.",
|
|
)
|
|
|
|
def handle(self, *args, **options):
|
|
monitor(run_once=options.get("run_once", False))
|