Skip to content

celery_worker

Command

Bases: BaseCommand

Source code in tasks/management/commands/celery_worker.py
15
16
17
18
class Command(BaseCommand):
    def handle(self, *args, **options):
        print('Starting celery worker with autoreload...')
        autoreload.run_with_reloader(restart_celery)

handle(*args, **options)

Source code in tasks/management/commands/celery_worker.py
16
17
18
def handle(self, *args, **options):
    print('Starting celery worker with autoreload...')
    autoreload.run_with_reloader(restart_celery)

restart_celery()

Source code in tasks/management/commands/celery_worker.py
 8
 9
10
11
12
def restart_celery():
    cmd = 'pkill -f "celery worker"'
    subprocess.call(shlex.split(cmd))
    cmd = 'celery -A backend worker -l info'
    subprocess.call(shlex.split(cmd))