diff --git a/README.md b/README.md index 6a370d2..757c5ef 100644 --- a/README.md +++ b/README.md @@ -17,4 +17,10 @@ MGET celery-task-meta- ### Checking results in Flower -`0.0.0.0: +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 diff --git a/compose/local/fastapi/celery/worker/start.sh b/compose/local/fastapi/celery/worker/start.sh index 03ebeae..af98c66 100644 --- a/compose/local/fastapi/celery/worker/start.sh +++ b/compose/local/fastapi/celery/worker/start.sh @@ -4,9 +4,7 @@ set -o errexit set -o nounset # Use watchfiles during development -CELERY_WORKER_WATCH=${CELERY_WORKER_WATCH:-} - -if [ -n "${CELERY_WORKER_WATCH}" ]; then +if [ "${CELERY_WORKER_WATCH:-false}" = true ]; then watchfiles --filter python 'celery -A main.celery worker --loglevel=info' else exec python -m celery -A main.celery worker --loglevel=info