Files
django-q2/django_q/management/commands/qcluster.py
T
Ilan Steemers 15155c7a99 Build improvements (#569)
* 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
2021-05-30 17:10:07 +02:00

25 lines
655 B
Python

from django.core.management.base import BaseCommand
from django.utils.translation import gettext as _
from django_q.cluster import Cluster
class Command(BaseCommand):
# Translators: help text for qcluster management command
help = _("Starts a Django Q Cluster.")
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):
q = Cluster()
q.start()
if options.get("run_once", False):
q.stop()