projects
/
mirror
/
dsa-puppet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
buxtehude needs to pg backup tools
[mirror/dsa-puppet.git]
/
modules
/
buildd
/
files
/
buildd-schroot-aptitude-kill
diff --git
a/modules/buildd/files/buildd-schroot-aptitude-kill
b/modules/buildd/files/buildd-schroot-aptitude-kill
index
c701a93
..
fa73746
100755
(executable)
--- a/
modules/buildd/files/buildd-schroot-aptitude-kill
+++ b/
modules/buildd/files/buildd-schroot-aptitude-kill
@@
-25,6
+25,7
@@
import os
import errno
import os
import errno
+import sys
try:
import psutil
except OSError, e:
try:
import psutil
except OSError, e:
@@
-38,20
+39,24
@@
cutoff_time = 60*10
for p in psutil.process_iter():
try:
for p in psutil.process_iter():
try:
- if p.name != 'aptitude': continue
- parent = p.parent
+ if p.name
()
!= 'aptitude': continue
+ parent = p.parent
()
if parent is None: continue
if parent is None: continue
- if parent.name != 'schroot': continue
+ if parent.name
()
!= 'schroot': continue
#
#
- rootdir = os.readlink('/proc/%d/root'%(p.pid,))
+ try:
+ rootdir = os.readlink('/proc/%d/root'%(p.pid,))
+ except OSError as e:
+ if e.errno == errno.ENOENT:
+ continue
+ else:
+ raise e
if not rootdir.startswith('/var/lib/schroot/mount'): continue
#
used = p.get_memory_info().vms
if not rootdir.startswith('/var/lib/schroot/mount'): continue
#
used = p.get_memory_info().vms
- if used < total_mem: continue
- #
cputime = p.get_cpu_times().user
cputime = p.get_cpu_times().user
- if cputime < cutoff_time: continue
+ if
used < total_mem and
cputime < cutoff_time: continue
#
p.kill()
#
p.kill()
- except psutil.
error.
NoSuchProcess:
+ except psutil.NoSuchProcess:
pass
pass