Commit de7cb13e by Dudás Ádám

vm: refactor check_queue task

parent 6636656e
...@@ -19,18 +19,16 @@ def check_queue(node_hostname, queue_id): ...@@ -19,18 +19,16 @@ def check_queue(node_hostname, queue_id):
active_queues = get_queues() active_queues = get_queues()
if active_queues is None: if active_queues is None:
return False return False
# v is List of List of queues dict queue_names = (queue['name'] for worker in active_queues.itervalues()
node_workers = [v for k, v in active_queues.iteritems()] for queue in worker)
for worker in node_workers: return queue_name in queue_names
for queue in worker:
if queue['name'] == queue_name:
return True
return False
def get_queues(): def get_queues():
"""Get active celery queues. """Get active celery queues.
Returns a dictionary whose entries are (worker name;list of queues) pairs,
where queues are represented by dictionaries.
Result is cached for 10 seconds! Result is cached for 10 seconds!
""" """
key = __name__ + u'queues' key = __name__ + u'queues'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment