mirror of
https://github.com/ceph/ceph
synced 2025-02-24 03:27:10 +00:00
qa/tasks: do not random.choice(a_view)
use `random.sample()` instead of `random.choice(list(a_view))` for better performance. Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
0930652318
commit
9ca45bd942
@ -1965,7 +1965,7 @@ class CephManager:
|
||||
"""
|
||||
with self.lock:
|
||||
if self.pools:
|
||||
return random.choice(self.pools.keys())
|
||||
return random.sample(self.pools.keys(), 1)[0]
|
||||
|
||||
def get_pool_pg_num(self, pool_name):
|
||||
"""
|
||||
|
@ -39,7 +39,7 @@ class TestDumpTree(CephFSTestCase):
|
||||
|
||||
self.populate()
|
||||
inos = self.get_paths_to_ino()
|
||||
target = random.choice(inos.keys())
|
||||
target = random.sample(inos.keys(), 1)[0]
|
||||
|
||||
if target != "./":
|
||||
target = os.path.dirname(target)
|
||||
|
Loading…
Reference in New Issue
Block a user