-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpenConceptLab/ocl_issues#927 Redis clustering, fixing celery config
- Loading branch information
1 parent
dcbe83a
commit ef1ff77
Showing
4 changed files
with
33 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,29 @@ | ||
import os | ||
from datetime import timedelta | ||
|
||
from celery import Celery | ||
from celery.schedules import crontab | ||
from django.conf import settings | ||
|
||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "core.settings") | ||
app = Celery('core') | ||
app.conf.ONCE = settings.CELERY_ONCE # force CELERY_ONCE to load settings | ||
app.conf.CELERYBEAT_SCHEDULE = settings.CELERYBEAT_SCHEDULE | ||
app.conf.ONCE = { | ||
'backend': 'core.common.backends.QueueOnceRedisBackend', | ||
} | ||
app.conf.CELERYBEAT_SCHEDULE = { | ||
'healthcheck-every-minute': { | ||
'task': 'core.common.tasks.beat_healthcheck', | ||
'schedule': timedelta(seconds=60), | ||
}, | ||
'first-of-every-month': { | ||
'task': 'core.common.tasks.monthly_usage_report', | ||
'schedule': crontab(1, 0, day_of_month='1'), | ||
}, | ||
'vacuum-and-analyze-db': { | ||
'task': 'core.common.tasks.vacuum_and_analyze_db', | ||
'schedule': crontab(0, 1), # Run at 1 am | ||
}, | ||
|
||
} | ||
app.config_from_object('django.conf:settings', namespace='CELERY') | ||
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters