def list_buckets_fast(self):
buckets = []
jobs = []
for profile in self.clients.keys():
queue = mp.Queue()
kwargs = {'profile_names': profile,
'queue': queue}
process = mp.Process(target=self.list_buckets,
kwargs=kwargs)
process.start()
jobs.append((process, queue))
count = 0
for job in jobs:
process = job[0]
queue = job[1]
process.join()
profile_buckets = queue.get()
buckets.extend(profile_buckets)
count += 1
for job in jobs:
process = job[0]
if process.is_alive():
process.terminate()
return buckets
评论列表
文章目录