Reputation: 7019
I have different celery queues and at a certain point I want workers to stop consuming from my queues
celery_app.control.cancel_consumer(consumer_queue)
In a while I want to be able to resume consumers and I do that with the next command
celery.control.add_consumer(
consumer_queue,
routing_key=consumer_queue,
destination=['worker-name'],
)
At this point I expect worker-name
will be fetching tasks from consumer_queue
which my custom router redirects by a routing_key
. But instead I have this output from a celery inspect
celery.control.inspect().active_queues()
{'celery@worker-name': []}
Some details
Celery: celery==3.1.23
Kombu: kombu==3.0.35
billiard: billiard==3.3.0.23
Note: adding consumer via celery flower (flower==0.8.4
) works even that the command is the same.
What am I doing wrong and how to reenable consuming in a proper way?
Upvotes: 0
Views: 872
Reputation: 7019
Ok, it was a premature question with a plain solution: I have provided wrong name for the worker, instead of setting worker-name
I should provide celery@worker-name
identifier.
For debug purposes it's also useful to set reply=True
argument
response = celery.control.add_consumer(
consumer_queue,
routing_key=consumer_queue,
destination=['celery@{}'.format(consumer)],
reply=True,
)
print(response)
and you'll see whether operation was successful or not
[{u'celery@worker-name': {u'ok': u'add consumer consumer-queue'}}]
Upvotes: 1