未验证 提交 829c635f 编写于 作者: W wangguanzhong 提交者: GitHub

enhance shm utils (#6043)

上级 c2d51430
...@@ -34,7 +34,10 @@ SHM_DEFAULT_MOUNT = '/dev/shm' ...@@ -34,7 +34,10 @@ SHM_DEFAULT_MOUNT = '/dev/shm'
def _parse_size_in_M(size_str): def _parse_size_in_M(size_str):
num, unit = size_str[:-1], size_str[-1] if size_str[-1] == 'B':
num, unit = size_str[:-2], size_str[-2]
else:
num, unit = size_str[:-1], size_str[-1]
assert unit in SIZE_UNIT, \ assert unit in SIZE_UNIT, \
"unknown shm size unit {}".format(unit) "unknown shm size unit {}".format(unit)
return float(num) * \ return float(num) * \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册