From a3ef26b7adee1fe28524dc739c2b7fae3ff2041c Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 11 Apr 2019 13:54:11 +0200 Subject: [PATCH] Run collectstatic before coverage, use autoreload on celery worker --- .gitlab-ci.yml | 1 + passbook/core/management/commands/web.py | 2 +- passbook/core/management/commands/worker.py | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3e582e7ad..abde87ea3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -40,6 +40,7 @@ pylint: stage: test coverage: script: + - python manage.py collectstatic --no-input - coverage run manage.py test - coverage report stage: test diff --git a/passbook/core/management/commands/web.py b/passbook/core/management/commands/web.py index 329e070e6..fe5b157bd 100644 --- a/passbook/core/management/commands/web.py +++ b/passbook/core/management/commands/web.py @@ -15,7 +15,7 @@ class Command(BaseCommand): """Run CherryPy webserver""" def handle(self, *args, **options): - """passbook cherrypy server""" + """passbook daphne server""" autoreload.run_with_reloader(self.daphne_server) def daphne_server(self): diff --git a/passbook/core/management/commands/worker.py b/passbook/core/management/commands/worker.py index 00971ca7b..1a20f22d5 100644 --- a/passbook/core/management/commands/worker.py +++ b/passbook/core/management/commands/worker.py @@ -3,6 +3,7 @@ from logging import getLogger from django.core.management.base import BaseCommand +from django.utils import autoreload from passbook.core.celery import CELERY_APP @@ -14,4 +15,9 @@ class Command(BaseCommand): 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'])