ceph-balancer
ceph-balancer copied to clipboard
JSON TypeError on show command when json output is used.
Hello!
I would like to use json output of the show command to parse shard sizes.
python3 placementoptimizer.py show --format json
then it outputs it but at the end there is an error:
[...]
"pools_acting": [1, 2, 3, 6, 9, 18], "pg_count_up": {"2": 41, "3": 23, "9": 2, "1": 5, "6": 2, "18": 1}, "pg_count_acting": {"2": 41, "3": 23, "9": 2, "1": 5, "6": 2, "18": 1}, "pg_num_up": 74, "pgs_up": Traceback (most recent call last):
File "placementoptimizer.py", line 5086, in <module>
exit(main())
File "placementoptimizer.py", line 5063, in main
show(args, state)
File "placementoptimizer.py", line 4850, in show
json.dump(ret, sys.stdout)
File "/usr/lib/python3.8/json/__init__.py", line 179, in dump
for chunk in iterable:
File "/usr/lib/python3.8/json/encoder.py", line 431, in _iterencode
yield from _iterencode_dict(o, _current_indent_level)
File "/usr/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
yield from chunks
File "/usr/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
yield from chunks
File "/usr/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
yield from chunks
File "/usr/lib/python3.8/json/encoder.py", line 438, in _iterencode
o = _default(o)
File "/usr/lib/python3.8/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type set is not JSON serializable
At the same time standard plain text output works ok.
Python version: Python 3.8.10 (default, Nov 14 2022, 12:59:47) Ceph version: Quincy 17.2.5
Hi! Can you send me your cluster state dump so I can reproduce the problem locally?
You can collect with ./placementoptimizer.py -v gather output.xz
Then please mail me this file or a link to it to jj at sft.lol
:)
fixed in 38e5d5f183c25b118f4564d0bdfe961553b9f0f0 :)
thanks a lot!
out of curiosity, what do you need the shardsizes for? :)