add celery beat schedule

This commit is contained in:
FuzzyGrim
2024-08-17 16:30:16 +02:00
parent 6e3e62d3cb
commit f74871d211
5 changed files with 12 additions and 3 deletions

View File

@@ -5,3 +5,4 @@ __pycache__
venv
src/staticfiles
src/db/db.sqlite3
celerybeat-schedule

1
.gitignore vendored
View File

@@ -5,3 +5,4 @@ __pycache__
venv
src/staticfiles
src/db/db.sqlite3
celerybeat-schedule

View File

@@ -99,7 +99,7 @@ Then run the following commands.
python -m pip install -U -r requirements-dev.txt
cd src
python manage.py migrate
python manage.py runserver & celery --app config worker -l DEBUG
python manage.py runserver & celery --app config worker --beat -S django --loglevel DEBUG
```
Go to: http://localhost:8000

View File

@@ -271,3 +271,10 @@ CELERY_CACHE_BACKEND = "default"
CELERY_TASK_SERIALIZER = "pickle"
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#std-setting-accept_content
CELERY_ACCEPT_CONTENT = ["application/json", "application/x-python-serialize"]
CELERY_BEAT_SCHEDULE = {
"reload_calendar": {
"task": "Reload calendar",
"schedule": 60 * 60 * 6, # every 6 hours
},
}

View File

@@ -12,7 +12,7 @@ stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:celery]
command=celery --app config worker --loglevel INFO --without-mingle --without-gossip
command=celery --app config worker --beat -S django --loglevel INFO --without-mingle --without-gossip
user=abc
stopasgroup=true
stopwaitsecs=60
@@ -20,4 +20,4 @@ priority=5
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
stderr_logfile_maxbytes=0