Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
532 views
in Technique[技术] by (71.8m points)

docker - Not able to run celery tasks from python shell

I am trying to run celery tasks asynchronously using the .delay() from python shell inside my local machine, The celery uses the rabbitmq as broker and both the celery and rabbitmq servers are running inside 2 different docker containers. The issue here is the celery workers are not connecting to rabbitmq servers

This is the config I'm using here

# celery config
    CELERY_ALWAYS_EAGER = False
    #Default config
    CELERY_BROKER = "amqp://rabbitmq:5672"

    #default config
    CELERY_RESULT_BACKEND = "redis://redis:6379/15"

The docker containers are port mapped to the respective ports of the host machine.

question from:https://stackoverflow.com/questions/65831989/not-able-to-run-celery-tasks-from-python-shell

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I think your backend configuration should also be of Rabbitmq. Please try to incorporate the below code for backend. Hope that should help! CELERY_RESULT_BACKEND = ='rpc://'


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...