FastAPI and Celery
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Drew Bednar e50d34e265 Improved start script and additional notes for testing 2 years ago
alembic Adding alembic and sql support 2 years ago
compose/local/fastapi Improved start script and additional notes for testing 2 years ago
project Using watchfiles and exec commands in bin scripts 2 years ago
.gitignore Adding alembic and sql support 2 years ago
.pre-commit-config.yaml Add shell check to pre-commit 2 years ago
.pylintrc Adding alembic and sql support 2 years ago
LICENSE Update license with user info 2 years ago
README.md Improved start script and additional notes for testing 2 years ago
alembic.ini Adding alembic and sql support 2 years ago
autocomplete.zsh Add celery and autocomplete for invoke 2 years ago
dev-requirements.in Add shell check to pre-commit 2 years ago
dev-requirements.txt Add shell check to pre-commit 2 years ago
docker-compose-redis.yml Initial wiring 2 years ago
docker-compose.yml docker composed local dev env 2 years ago
main.py Adding alembic and sql support 2 years ago
requirements.in Add shell check to pre-commit 2 years ago
requirements.txt Using watchfiles and exec commands in bin scripts 2 years ago
tasks.py docker composed local dev env 2 years ago

README.md

FastAPI and Celery

Learning distributed task queues by doing. Since it's a greenfield project this also uses a newer async web framework.

See: Celery docs

Debugging Celery

Check results in redis result backend

docker-compose exec redis sh
redis-cli
KEYS celery*
MGET celery-task-meta-<UID of Task>

Checking results in Flower

Use the flower dashboard at: 0.0.0.0:5557

Eager Task Processing

CELERY_TASK_ALWAYS_EAGER: bool = True will synchronously execute the celery tasks. This allows us to use things like breakpoint() to enter a debugger within the execution context of the task.

Since the app currently uses the fastapi application config for celery config, add CELERY_TASK_ALWAYS_EAGER=True to the config class if needed. You don't need to run the worker, message broker, or result backend processes to debug your code. It will process the task within