fix find_victim

This commit is contained in:
Alexey Avramov
2019-01-11 02:04:40 +09:00
parent 020bdf3f09
commit 522d1507ee

35
nohang
View File

@@ -585,9 +585,12 @@ def find_victim_and_send_signal(signal):
stat_dict.update({key: 1}) stat_dict.update({key: 1})
else: else:
new_value = stat_dict[key] + 1 new_value = stat_dict[key] + 1
stat_dict.update({key: new_value}) stat_dict.update({key: new_value}
for key in stat_dict:
stats_msg += '\n - {}: {}'.format(key, stat_dict[key])
print(stats_msg)
return None return None
except ProcessLookupError: except ProcessLookupError:
print('The victim died in the search process') print('The victim died in the search process')
@@ -597,9 +600,12 @@ def find_victim_and_send_signal(signal):
stat_dict.update({key: 1}) stat_dict.update({key: 1})
else: else:
new_value = stat_dict[key] + 1 new_value = stat_dict[key] + 1
stat_dict.update({key: new_value}) stat_dict.update({key: new_value}
for key in stat_dict:
stats_msg += '\n - {}: {}'.format(key, stat_dict[key])
print(stats_msg)
return None return None
except IndexError: except IndexError:
print('The victim died in the search process') print('The victim died in the search process')
@@ -609,9 +615,12 @@ def find_victim_and_send_signal(signal):
stat_dict.update({key: 1}) stat_dict.update({key: 1})
else: else:
new_value = stat_dict[key] + 1 new_value = stat_dict[key] + 1
stat_dict.update({key: new_value}) stat_dict.update({key: new_value}
for key in stat_dict:
stats_msg += '\n - {}: {}'.format(key, stat_dict[key])
print(stats_msg)
return None return None
except ValueError: except ValueError:
print('The victim died in the search process') print('The victim died in the search process')
@@ -621,8 +630,10 @@ def find_victim_and_send_signal(signal):
stat_dict.update({key: 1}) stat_dict.update({key: 1})
else: else:
new_value = stat_dict[key] + 1 new_value = stat_dict[key] + 1
stat_dict.update({key: new_value}) stat_dict.update({key: new_value}
for key in stat_dict:
stats_msg += '\n - {}: {}'.format(key, stat_dict[key])
print(stats_msg)
return None return None
len_vm = len(str(vm_size)) len_vm = len(str(vm_size))
@@ -704,6 +715,10 @@ def find_victim_and_send_signal(signal):
new_value = stat_dict[key] + 1 new_value = stat_dict[key] + 1
stat_dict.update({key: new_value}) stat_dict.update({key: new_value})
for key in stat_dict:
stats_msg += '\n - {}: {}'.format(key, stat_dict[key])
print(mem_info) print(mem_info)
print(etc_info) print(etc_info)
@@ -757,10 +772,6 @@ def find_victim_and_send_signal(signal):
new_value = stat_dict[key] + 1 new_value = stat_dict[key] + 1
stat_dict.update({key: new_value}) stat_dict.update({key: new_value})
preventing_oom_message = '{}' \ preventing_oom_message = '{}' \
'\n\033[4mImplement a corrective action:\033[0m\n ' \ '\n\033[4mImplement a corrective action:\033[0m\n ' \
'Sending \033[4m{}\033[0m to the victim; {}'.format( 'Sending \033[4m{}\033[0m to the victim; {}'.format(