fix syntax

This commit is contained in:
Alexey Avramov 2019-08-31 22:35:23 +09:00
parent 49d6eb406b
commit 602150a30f
3 changed files with 5 additions and 4 deletions

6
nohang
View File

@ -611,7 +611,7 @@ def pid_to_status(pid):
for n, line in enumerate(f): for n, line in enumerate(f):
if n is 0: if n == 0:
name = line.split('\t')[1][:-1] name = line.split('\t')[1][:-1]
if n is state_index: if n is state_index:
@ -663,7 +663,7 @@ def pid_to_status_unicode(pid):
for i in range(len(f_list)): for i in range(len(f_list)):
if i is 0: if i == 0:
name = f_list[i].split('\t')[1] name = f_list[i].split('\t')[1]
if i is state_index: if i is state_index:
@ -793,7 +793,7 @@ def check_mem_and_swap():
"""find mem_available, swap_total, swap_free""" """find mem_available, swap_total, swap_free"""
with open('/proc/meminfo') as f: with open('/proc/meminfo') as f:
for n, line in enumerate(f): for n, line in enumerate(f):
if n is 2: if n == 2:
mem_available = int(line.split(':')[1][:-4]) mem_available = int(line.split(':')[1][:-4])
continue continue
if n is swap_total_index: if n is swap_total_index:

View File

@ -9,6 +9,7 @@ KillMode=mixed
OOMPolicy=continue OOMPolicy=continue
Nice=-15 Nice=-15
CPUSchedulingResetOnFork=true CPUSchedulingResetOnFork=true
MemoryMin=50%
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -42,7 +42,7 @@ def pid_to_status_units(pid):
for i in range(len(f_list)): for i in range(len(f_list)):
if i is 1: if i == 1:
name = f_list[0].split('\t')[1] name = f_list[0].split('\t')[1]
if i == uid_index: if i == uid_index: