Add celery app instance with base config

This patch allows to schedule tasks and launch workers with basic
config. To launch a worker:

    celery -A module_build_service.celery_app -l info

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
This commit is contained in:
Chenxiong Qi
2019-11-13 17:17:42 +08:00
committed by mprahl
parent 5f4ef94103
commit fa697a950d
5 changed files with 29 additions and 0 deletions

View File

@@ -92,6 +92,18 @@ class BaseConfiguration(object):
# Disable Client Authorization
NO_AUTH = False
# Configs for running tasks asynchronously with Celery
# For details of Celery configs, refer to Celery documentation:
# https://docs.celeryproject.org/en/latest/userguide/configuration.html
#
# Each config name consists of namespace CELERY_ and the new Celery config
# name converted to upper case. For example the broker url, Celery config
# name is broker_url, then as you can below, the corresponding config name
# in MBS is CELERY_BROKER_URL.
CELERY_BROKER_URL = ""
CELERY_RESULT_BACKEND = ""
CELERY_IMPORTS = []
class TestConfiguration(BaseConfiguration):
BUILD_LOGS_DIR = "/tmp"
@@ -154,3 +166,6 @@ class OfflineLocalBuildConfiguration(LocalBuildConfiguration):
class DevConfiguration(LocalBuildConfiguration):
DEBUG = True
LOG_BACKEND = "console"
CELERY_BROKER_URL = "redis://localhost:6379/0"
CELERY_RESULT_BACKEND = "redis://localhost:6379/0"