mirror of
https://github.com/django-q2/django-q2.git
synced 2026-09-15 13:37:56 +08:00
* Black linting * Adding Black to dev dependencies and upping minimal python to 3.6.2 for compatibility * Updating packages * Removing pip-tools input and exporting requirements with poetry * Deleting old setup files and test runner * Trying 1.3.7 * Looser extras requirements to prevent conflicts * Sorted imports with isort * Added iSort to dev dependencies * Fixes localtime for naive setups
32 lines
889 B
Python
32 lines
889 B
Python
from django.core.management.base import BaseCommand
|
|
from django.utils.translation import gettext as _
|
|
|
|
from django_q.monitor import memory
|
|
|
|
|
|
class Command(BaseCommand):
|
|
# Translators: help text for qmemory management command
|
|
help = _("Monitors Q Cluster memory usage")
|
|
|
|
def add_arguments(self, parser):
|
|
parser.add_argument(
|
|
"--run-once",
|
|
action="store_true",
|
|
dest="run_once",
|
|
default=False,
|
|
help="Run once and then stop.",
|
|
)
|
|
parser.add_argument(
|
|
"--workers",
|
|
action="store_true",
|
|
dest="workers",
|
|
default=False,
|
|
help="Show each worker's memory usage.",
|
|
)
|
|
|
|
def handle(self, *args, **options):
|
|
memory(
|
|
run_once=options.get("run_once", False),
|
|
workers=options.get("workers", False),
|
|
)
|