in ccmlib/node.py [0:0]
def _get_load_from_info_output(info):
load_lines = [s for s in info.split('\n')
if s.startswith('Load')]
if not len(load_lines) == 1:
msg = ('Expected output from `nodetool info` to contain exactly 1 '
'line starting with "Load". Found:\n') + info
raise RuntimeError(msg)
load_line = load_lines[0].split()
# Don't have access to C* version here, so we need to support both prefix styles
# See CASSANDRA-9692 on Apache JIRA
unit_multipliers = {'KiB': 1,
'KB': 1,
'MiB': 1024,
'MB': 1024,
'GiB': 1024 * 1024,
'GB': 1024 * 1024,
'TiB': 1024 * 1024 * 1024,
'TB': 1024 * 1024 * 1024}
load_num, load_units = load_line[2], load_line[3]
try:
load_mult = unit_multipliers[load_units]
except KeyError:
expected = ', '.join(list(unit_multipliers))
msg = ('Expected `nodetool info` to report load in one of the '
'following units:\n'
' {expected}\n'
'Found:\n'
' {found}').format(expected=expected, found=load_units)
raise RuntimeError(msg)
return float(load_num) * load_mult