Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Workaround for celery task priority on RabbitMQ?

I am running Django with Celery on top of RabbitMQ as a queue to handle some data processing tasks. I am kicking off celery tasks when a user first signs up, as well as periodically to update their data. However, I'd like to of course give priority to the tasks running users who are currently online. I noticed there was a priority setting for tasks in celery, but it seems that rabbitmq does not support this. This thread http://groups.google.com/group/celery-users/browse_thread/thread/ac3b6123d63421e5/b7740def1389e87e?lnk=gst&q=priority#b7740def1389e87e suggests have two different queues, a high priority one and a low priority one, or setting a rate limit for lower priority tasks.

Does anyone have a good workaround to implement priority? Thanks in advance!

like image 456
David Avatar asked Jul 31 '10 18:07

David


People also ask

Does RabbitMQ support priority?

Sometimes messages simply have a higher priority and need to be handled before other messages. Thankfully, RabbitMQ supports priority queues.

Does Celery need RabbitMQ?

Installation & configuration We will install celery using pip. We don't use sudo as we are installing celery to our virtual environment. However, we also need to install rabbitmq on the system as it runs in the background. The -detached option allows us to run rabbitmq-server in the background.

How do you run Celery with RabbitMQ?

Clients submit jobs to the message broker, and the queue is listening for job requests using Celery. The message broker then distributes job requests to workers. Workers wait for jobs from Celery and execute the tasks. When finished, the worker sends a result to another queue for the client to process.


1 Answers

As I understand it, and I've not yet done this, Ask covers this here:

http://docs.celeryproject.org/en/master/faq.html#does-celery-support-task-priorities [stable] http://docs.celeryproject.org/en/latest/faq.html#does-celery-support-task-priorities [latest]

like image 85
tobych Avatar answered Nov 27 '22 22:11

tobych