Commit dd0e44ed by Dudás Ádám

storage: refactor check_queue task

parent 9e5265b4
...@@ -10,16 +10,14 @@ def check_queue(storage, queue_id): ...@@ -10,16 +10,14 @@ 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()]
for worker in node_workers:
for queue in worker:
if queue['name'] == queue_name:
return True
return False return False
queue_names = (queue['name'] for worker in active_queues.itervalues()
for queue in worker)
return queue_name in queue_names
@celery.task @celery.task
def save_as(disk, timeout, user): def save_as(disk, timeout, user):
......
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