Reputation:
I am having a fastapi when i build container image i was unable to run the celery worker
dockercompose
file
version: "3.8"
services:
web:
build: .
ports:
- "8080:8000"
command: uvicorn app.main:app --host 0.0.0.0 --reload
environment:
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
depends_on:
- redis
worker:
build: .
command: celery worker --app=worker.celery --loglevel=info
environment:
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
depends_on:
- web
- redis
redis:
image: redis:6-alpine
dashboard:
build: .
command: flower --app=worker.celery --port=5555 --broker=redis://redis:6379/0
ports:
- 5556:5555
environment:
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
depends_on:
- web
- redis
- worker
I am getting this error You are using
--app as an option of the worker sub-command
celery worker --app celeryapp <...>
The support for this usage was removed in Celery 5.0. Instead you should use --app
as a global option:
celery --app celeryapp worker <...>
Error: no such option: --app
. I am not sure where i am doing wrong
Upvotes: 0
Views: 1325
Reputation: 52802
The error message tells you what you need to change - the --app
parameter has moved from being a parameter to celery worker
to being a parameter to celery
instead.
Your old command:
celery worker --app=worker.celery --loglevel=info
needs to be changed by moving --app
to the left (so that it is a parameter to celery
instead):
celery --app=worker.celery worker --loglevel=info
Upvotes: 2