Commit ce4a783
Kyr Shatskyy
qa/tasks/ceph_manager: population must be a sequence
This patch addresses TypeError message for rados_bench if there is
python3.11 for example.
2025-04-17T17:05:45.719 INFO:tasks.thrashosds.thrasher:Traceback (most recent call last):
File "/home/debian/src/github.com_kshtsk_ceph_b8b19a59890781db2f405500155c975cbdeb38a1/qa/tasks/ceph_manager.py", line 192, in wrapper
return func(self)
^^^^^^^^^^
File "/home/debian/src/github.com_kshtsk_ceph_b8b19a59890781db2f405500155c975cbdeb38a1/qa/tasks/ceph_manager.py", line 1439, in _do_thrash
self.choose_action()()
File "/home/debian/src/github.com_kshtsk_ceph_b8b19a59890781db2f405500155c975cbdeb38a1/qa/tasks/ceph_manager.py", line 855, in grow_pool
pool = self.ceph_manager.get_pool()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/debian/src/github.com_kshtsk_ceph_b8b19a59890781db2f405500155c975cbdeb38a1/qa/tasks/ceph_manager.py", line 2221, in get_pool
return random.sample(self.pools.keys(), 1)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/random.py", line 439, in sample
raise TypeError("Population must be a sequence. "
TypeError: Population must be a sequence. For dicts or sets, use sorted(d).
This happens because dict.keys() returns dict_keys() instead of list,
however the random.sample() accepts a list only as first argument
because sampling from a set deprecated since Python 3.9 and eventually
removed since 3.11 version.
Signed-off-by: Kyr Shatskyy <[email protected]>1 parent 4e368a9 commit ce4a783
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2298 | 2298 | | |
2299 | 2299 | | |
2300 | 2300 | | |
2301 | | - | |
| 2301 | + | |
2302 | 2302 | | |
2303 | 2303 | | |
2304 | 2304 | | |
| |||
0 commit comments