-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from uktrade/feature/celery-configuration
chore:add Celery and Django Celery Beat configuration
- Loading branch information
Showing
3 changed files
with
30 additions
and
7 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,9 +1,20 @@ | ||
import os | ||
|
||
from celery import Celery | ||
from celery.schedules import crontab | ||
from dbt_copilot_python.celery_health_check import healthcheck | ||
|
||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fbr.config.settings.local") | ||
|
||
app = Celery("fbr_celery") | ||
celery_app = Celery("fbr_celery") | ||
celery_app.config_from_object("django.conf:settings.base", namespace="CELERY") | ||
celery_app.autodiscover_tasks() | ||
|
||
# Load settings from Django or directly | ||
app.config_from_object("django.conf:settings", namespace="CELERY") | ||
celery_app = healthcheck.setup(celery_app) | ||
|
||
# Auto-discover tasks in installed apps | ||
app.autodiscover_tasks() | ||
celery_app.conf.beat_schedule = { | ||
"schedule-fbr-cache-task": { | ||
"task": "fbr.cache.tasks.rebuild_cache", | ||
"schedule": crontab(hour="1", minute="0"), | ||
}, | ||
} |
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