mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2026-02-06 07:06:19 +01:00
Replace django-celery with base Celery (#791)
Update celery tasks to new style & remove djcelery Vanilla celery + django-celery-beat take over the role of djcelery. Task schedules are consolidated into settings instead of residing in code. Update docs and example supervisor configs.
This commit is contained in:
@@ -12,17 +12,12 @@ https://docs.djangoproject.com/en/1.10/ref/settings/
|
||||
|
||||
import os
|
||||
|
||||
import djcelery
|
||||
|
||||
from django.contrib import messages
|
||||
from celery.schedules import crontab
|
||||
|
||||
djcelery.setup_loader()
|
||||
|
||||
# Celery configuration
|
||||
BROKER_URL = 'redis://localhost:6379/0'
|
||||
CELERYBEAT_SCHEDULER = "djcelery.schedulers.DatabaseScheduler"
|
||||
CELERYBEAT_SCHEDULE = dict()
|
||||
CELERYBEAT_SCHEDULER = "django_celery_beat.schedulers.DatabaseScheduler"
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
@@ -50,7 +45,7 @@ INSTALLED_APPS = [
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.humanize',
|
||||
'djcelery',
|
||||
'django_celery_beat',
|
||||
'bootstrapform',
|
||||
'authentication',
|
||||
'services',
|
||||
@@ -237,6 +232,25 @@ NOCAPTCHA = True
|
||||
##
|
||||
#####################################################
|
||||
|
||||
|
||||
#########################
|
||||
# CELERY SCHEDULED TASKS
|
||||
#########################
|
||||
CELERYBEAT_SCHEDULE = {
|
||||
'run_api_refresh': {
|
||||
'task': 'eveonline.tasks.run_api_refresh',
|
||||
'schedule': crontab(minute=0, hour="*/3"),
|
||||
},
|
||||
'run_corp_update': {
|
||||
'task': 'eveonline.tasks.run_corp_update',
|
||||
'schedule': crontab(minute=0, hour="*/2"),
|
||||
},
|
||||
'update_all_corpstats': {
|
||||
'task': 'corputils.tasks.update_all_corpstats',
|
||||
'schedule': crontab(minute=0, hour="*/6"),
|
||||
},
|
||||
}
|
||||
|
||||
#################
|
||||
# EMAIL SETTINGS
|
||||
#################
|
||||
|
||||
Reference in New Issue
Block a user