Reputation: 376
For a Python/Django/Celery based deployment tool, we have the following setup:
The following specs need to be fulfilled:
What is the preferred way to implement this?
Some thoughts:
Upvotes: 12
Views: 1126
Reputation: 2341
for 1,2 use multiple queues and launch workers with -Q to specify what queue to listen. Also configure CELERYD_PREFETCH_MULTIPLIER = 1, for only one task at a time.
To get the queue lenght (tested with rabbitmq), you can use something like this:
from kombu.connection import BrokerConnection
connection = BrokerConnection(BROKER_HOST, BROKER_USER...)
channel = connection.channel()
q, j, c = channel.queue_declare('celery', passive=True)
print 'celery %d jobs in queue' % j
'queue_delcare' as a side effect, give you the queue's length. Hope this can help you.
Upvotes: 2