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.
|
|
3 years ago | |
|---|---|---|
| alembic | 3 years ago | |
| compose/local/fastapi | 3 years ago | |
| project | 3 years ago | |
| .gitignore | 3 years ago | |
| .pre-commit-config.yaml | 3 years ago | |
| .pylintrc | 3 years ago | |
| LICENSE | 3 years ago | |
| README.md | 3 years ago | |
| alembic.ini | 3 years ago | |
| autocomplete.zsh | 3 years ago | |
| dev-requirements.in | 3 years ago | |
| dev-requirements.txt | 3 years ago | |
| docker-compose-redis.yml | 3 years ago | |
| docker-compose.yml | 3 years ago | |
| main.py | 3 years ago | |
| requirements.in | 3 years ago | |
| requirements.txt | 3 years ago | |
| tasks.py | 3 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