Files
authentik/passbook/core/management/commands/worker.py
Jens Langhammer a798412e17 separate passbook.core into passbook.root and passbook.core
Move Main Django Project into passbook.root while passbook.core holds core functionality.

passbook.root contains main settings, ASGI & WSGI, celery and URLs.
2019-06-25 18:00:54 +02:00

24 lines
617 B
Python

"""passbook Worker management command"""
from logging import getLogger
from django.core.management.base import BaseCommand
from django.utils import autoreload
from passbook.root.celery import CELERY_APP
LOGGER = getLogger(__name__)
class Command(BaseCommand):
"""Run Celery Worker"""
def handle(self, *args, **options):
"""celery worker"""
autoreload.run_with_reloader(self.celery_worker)
def celery_worker(self):
"""Run celery worker within autoreload"""
autoreload.raise_last_exception()
CELERY_APP.worker_main(['worker', '--autoscale=10,3', '-E', '-B'])