Commit dd0e44ed by Dudás Ádám

storage: refactor check_queue task

parent 9e5265b4
...@@ -10,15 +10,13 @@ def check_queue(storage, queue_id): ...@@ -10,15 +10,13 @@ def check_queue(storage, queue_id):
drivers = ['storage', 'download'] drivers = ['storage', 'download']
worker_list = [storage + "." + d for d in drivers] worker_list = [storage + "." + d for d in drivers]
queue_name = storage + "." + queue_id queue_name = storage + "." + queue_id
# v is List of List of queues dict
active_queues = celery.control.inspect(worker_list).active_queues() active_queues = celery.control.inspect(worker_list).active_queues()
if active_queues is not None: if active_queues is None:
node_workers = [v for k, v in active_queues.iteritems()] return False
for worker in node_workers:
for queue in worker: queue_names = (queue['name'] for worker in active_queues.itervalues()
if queue['name'] == queue_name: for queue in worker)
return True return queue_name in queue_names
return False
@celery.task @celery.task
......
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