fix style
This commit is contained in:
parent
2c747023b7
commit
f48ce59382
33
nohang
33
nohang
@ -35,17 +35,6 @@ psi_support = os.path.exists(psi_path)
|
|||||||
# function definition section
|
# function definition section
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def update_stat_dict(key):
|
|
||||||
if key not in stat_dict:
|
|
||||||
stat_dict.update({key: 1})
|
|
||||||
else:
|
|
||||||
new_value = stat_dict[key] + 1
|
|
||||||
stat_dict.update({key: new_value})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def update_stat_dict_and_print(key):
|
def update_stat_dict_and_print(key):
|
||||||
if key not in stat_dict:
|
if key not in stat_dict:
|
||||||
stat_dict.update({key: 1})
|
stat_dict.update({key: 1})
|
||||||
@ -58,17 +47,6 @@ def update_stat_dict_and_print(key):
|
|||||||
stats_msg += '\n- {}: {}'.format(i, stat_dict[i])
|
stats_msg += '\n- {}: {}'.format(i, stat_dict[i])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def psi_mem_some_avg_total():
|
def psi_mem_some_avg_total():
|
||||||
if psi_support:
|
if psi_support:
|
||||||
return float(rline1(psi_path).rpartition('=')[2])
|
return float(rline1(psi_path).rpartition('=')[2])
|
||||||
@ -707,8 +685,6 @@ def find_victim_and_send_signal(signal):
|
|||||||
print(key)
|
print(key)
|
||||||
update_stat_dict_and_print(key)
|
update_stat_dict_and_print(key)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print(mem_info)
|
print(mem_info)
|
||||||
print(etc_info)
|
print(etc_info)
|
||||||
|
|
||||||
@ -723,8 +699,6 @@ def find_victim_and_send_signal(signal):
|
|||||||
send_result = '\033[32mOK\033[0m; response time: {} ms'.format(
|
send_result = '\033[32mOK\033[0m; response time: {} ms'.format(
|
||||||
round(response_time * 1000))
|
round(response_time * 1000))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# update stat_dict
|
# update stat_dict
|
||||||
key = 'Send \033[35m{}\033[0m to \033[35m{}\033[0m'.format(
|
key = 'Send \033[35m{}\033[0m to \033[35m{}\033[0m'.format(
|
||||||
sig_dict[signal], name)
|
sig_dict[signal], name)
|
||||||
@ -732,8 +706,6 @@ def find_victim_and_send_signal(signal):
|
|||||||
update_stat_dict_and_print(key)
|
update_stat_dict_and_print(key)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if gui_notifications:
|
if gui_notifications:
|
||||||
send_notify(signal, name, pid)
|
send_notify(signal, name, pid)
|
||||||
|
|
||||||
@ -751,7 +723,6 @@ def find_victim_and_send_signal(signal):
|
|||||||
send_result = 'no such process; response time: {} ms'.format(
|
send_result = 'no such process; response time: {} ms'.format(
|
||||||
round(response_time * 1000))
|
round(response_time * 1000))
|
||||||
|
|
||||||
|
|
||||||
# update stat_dict
|
# update stat_dict
|
||||||
key = 'The victim died in the search process'
|
key = 'The victim died in the search process'
|
||||||
update_stat_dict_and_print(key)
|
update_stat_dict_and_print(key)
|
||||||
@ -775,7 +746,6 @@ def find_victim_and_send_signal(signal):
|
|||||||
else:
|
else:
|
||||||
|
|
||||||
response_time = time() - time0
|
response_time = time() - time0
|
||||||
print('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')
|
|
||||||
print(mem_info)
|
print(mem_info)
|
||||||
victim_badness_is_too_small = 'victim badness {} < min_b' \
|
victim_badness_is_too_small = 'victim badness {} < min_b' \
|
||||||
'adness {}; nothing to do; response time: {} ms'.format(
|
'adness {}; nothing to do; response time: {} ms'.format(
|
||||||
@ -790,7 +760,6 @@ def find_victim_and_send_signal(signal):
|
|||||||
key = 'victim badness < min_badness'
|
key = 'victim badness < min_badness'
|
||||||
update_stat_dict_and_print(key)
|
update_stat_dict_and_print(key)
|
||||||
|
|
||||||
|
|
||||||
stats_msg = '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\033[4mUptime: {}; corrective actions:\033[0m'.format(
|
stats_msg = '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\033[4mUptime: {}; corrective actions:\033[0m'.format(
|
||||||
format_time(time() - start_time))
|
format_time(time() - start_time))
|
||||||
|
|
||||||
@ -799,8 +768,6 @@ def find_victim_and_send_signal(signal):
|
|||||||
|
|
||||||
print(stats_msg)
|
print(stats_msg)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sleep_after_send_signal(signal)
|
sleep_after_send_signal(signal)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user