提交 16d94309 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!450 Remove bytes2human which not presented in psutil 5.6.1

Merge pull request !450 from LiHongzhang/no_readable
......@@ -15,20 +15,13 @@
"""The memory collector."""
import psutil
from psutil._common import bytes2human
def collect_mem(readable=False):
def collect_mem():
"""
Collect the virtual memory info.
Args:
readable (bool): Read the sizes like 1K, 234M, 2G etc.
Returns:
dict, the virtual memory info.
"""
mem = psutil.virtual_memory()._asdict()
if not readable:
return dict(mem)
return {k: v if k == 'percent' else bytes2human(v) for k, v in mem.items()}
return dict(psutil.virtual_memory()._asdict())
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册