Harish
Harish

Reputation: 425

Django Celery Worker Not reciving the Tasks

Whenever I am running the celery worker I am getting the warning

./manage.py celery worker -l info --concurrency=8

enter image description here

and if I am ignored this warning then my celery worker not receiving the celery beat tasks

After googled I have also changed the worker name, but this time I am not receiving the warning but celery worker still not receiving the celery beat scheduled tasks

I have checked the celery beat logs, and celery beat scheduling the task on time.

I have also checked the celery flower and its showing two workers and the first worker is receiving the tasks and not executing it, how to send all task the second worker? or how can i disable the first kombu worker, what is djagno-celery setting that i am missing?

My django settings.py

RABBITMQ_USERNAME = "guest"
RABBITMQ_PASSWORD = "guest"
BROKER_URL = 'amqp://%s:%s@localhost:5672//' % (RABBITMQ_USERNAME, 
RABBITMQ_PASSWORD)
CELERY_DEFAULT_QUEUE = 'default'
CELERY_DEFAULT_EXCHANGE = 'default'
CELERY_DEFAULT_ROUTING_KEY = 'default'
CELERY_IGNORE_RESULT = True
CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
celery_enable_utc=True
import djcelery
djcelery.setup_loader()

Upvotes: 1

Views: 8025

Answers (1)

Artur Bersan
Artur Bersan

Reputation: 111

You only enabled the worker. For a task to be executed, you must call the task with the help of the your_task.delay () function. For example, open another terminal, enter your project, and run the python manage.py shell command. When entering the shell of your project Django, import your task and run the command your_task.delay () In the following link, there is an example of celery code with rabbitmq broker, I advise you to study it: https://github.com/celery/celery/tree/master/examples/django

Upvotes: 3

Related Questions