Fix crash

This commit is contained in:
Alexey Avramov 2020-05-07 00:50:30 +09:00
parent 20e258737c
commit c589d32a1f

View File

@ -851,13 +851,8 @@ def print_version():
def psi_file_mem_to_metrics(psi_path): def psi_file_mem_to_metrics(psi_path):
""" """
""" """
foo = read_path(psi_path) with open(psi_path) as f:
psi_list = f.readlines()
if foo is None:
return None
psi_list = foo.split('\n')
some_list, full_list = psi_list[0].split(' '), psi_list[1].split(' ') some_list, full_list = psi_list[0].split(' '), psi_list[1].split(' ')
some_avg10 = some_list[1].split('=')[1] some_avg10 = some_list[1].split('=')[1]
some_avg60 = some_list[2].split('=')[1] some_avg60 = some_list[2].split('=')[1]
@ -865,7 +860,6 @@ def psi_file_mem_to_metrics(psi_path):
full_avg10 = full_list[1].split('=')[1] full_avg10 = full_list[1].split('=')[1]
full_avg60 = full_list[2].split('=')[1] full_avg60 = full_list[2].split('=')[1]
full_avg300 = full_list[3].split('=')[1] full_avg300 = full_list[3].split('=')[1]
return (some_avg10, some_avg60, some_avg300, return (some_avg10, some_avg60, some_avg300,
full_avg10, full_avg60, full_avg300) full_avg10, full_avg60, full_avg300)
@ -3573,9 +3567,7 @@ if 'psi_path' in config_dict:
psi_path = config_dict['psi_path'] psi_path = config_dict['psi_path']
if CHECK_PSI: if CHECK_PSI:
try: try:
if psi_file_mem_to_metrics(psi_path) is None: psi_file_mem_to_metrics(psi_path)
errprint('WARNING: psi_path "{}" is not found or is incor'
'rect'.format(psi_path))
except Exception as e: except Exception as e:
errprint('WARNING: invalid psi_path "{}": {}'.format(psi_path, e)) errprint('WARNING: invalid psi_path "{}": {}'.format(psi_path, e))
else: else: