fix readme

This commit is contained in:
Alexey Avramov 2018-12-14 16:03:13 +09:00
parent 5839b0d8b6
commit 8f43c5528d
2 changed files with 21 additions and 18 deletions

View File

@ -177,6 +177,7 @@ See also `man journalctl`.
- Awful documentation - Awful documentation
- Slowly starting, slowly looking for a victim, especially when using swapspace - Slowly starting, slowly looking for a victim, especially when using swapspace
- It is written in an interpreted language and is actually a prototype
## Contribution ## Contribution

38
nohang
View File

@ -2,13 +2,16 @@
"""A daemon that prevents OOM in Linux systems.""" """A daemon that prevents OOM in Linux systems."""
from time import sleep, time from time import sleep, time
start_time = time() start_time = time()
import os import os
from operator import itemgetter from operator import itemgetter
# this is most slow import
from argparse import ArgumentParser from argparse import ArgumentParser
from sys import stdout from sys import stdout
from signal import SIGKILL, SIGTERM from signal import SIGKILL, SIGTERM
sig_dict = {SIGKILL: 'SIGKILL', sig_dict = {SIGKILL: 'SIGKILL',
SIGTERM: 'SIGTERM'} SIGTERM: 'SIGTERM'}
''' '''
@ -16,8 +19,6 @@ nm = 30
nc = nm + 1 nc = nm + 1
''' '''
stat_dict = dict()
########################################################################## ##########################################################################
@ -770,22 +771,24 @@ print('The path to the config:', config)
# conf_parameters_dict # conf_parameters_dict
# conf_restart_dict # conf_restart_dict
# dictionary with config options
config_dict = dict()
processname_re_list = []
cmdline_re_list = []
uid_re_list = []
# dictionary with names and commands for the parameter
# execute_the_command
# тут тоже список нужен, а не словарь
etc_dict = dict()
# will store corrective actions stat
stat_dict = dict()
try: try:
with open(config) as f: with open(config) as f:
# dictionary with config options
config_dict = dict()
processname_re_list = []
cmdline_re_list = []
uid_re_list = []
# dictionary with names and commands for the parameter
# execute_the_command
# тут тоже список нужен, а не словарь
etc_dict = dict()
for line in f: for line in f:
a = line.startswith('#') a = line.startswith('#')
@ -823,7 +826,6 @@ try:
a = line.partition('@UID_RE')[2].strip(' \n').partition('///') a = line.partition('@UID_RE')[2].strip(' \n').partition('///')
uid_re_list.append((a[0].strip(' '), a[2].strip(' '))) uid_re_list.append((a[0].strip(' '), a[2].strip(' ')))
except PermissionError: except PermissionError:
print('PermissionError', conf_err_mess) print('PermissionError', conf_err_mess)
exit() exit()
@ -1400,7 +1402,7 @@ while True:
else: else:
# СТОИТ ПЕЧАТАТЬ СВОП ТОЛЬКО ПРИ SwapTotal > 0 # СТОИТ ПЕЧАТАТЬ СВОП ТОЛЬКО ПРИ SwapTotal > 0
# нет, печатать так: SwapTotal = 0 KiB, ignore swapspace # нет, печатать так: SwapTotal = 0, ignore swapspace
swap_sigterm_pc = '-' swap_sigterm_pc = '-'
# Limits overdrafting checks # Limits overdrafting checks