mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Catch NoSuchProcess
This commit is contained in:
parent
0db615b40b
commit
7b48ac007d
1 changed files with 4 additions and 1 deletions
|
@ -155,7 +155,10 @@ def top(num_processes=5, interval=3):
|
|||
time.sleep(interval)
|
||||
usage = set()
|
||||
for process, start in six.iteritems(start_usage):
|
||||
user, system = process.cpu_times()[:2]
|
||||
try:
|
||||
user, system = process.cpu_times()[:2]
|
||||
except psutil.NoSuchProcess:
|
||||
continue
|
||||
now = user + system
|
||||
diff = now - start
|
||||
usage.add((diff, process))
|
||||
|
|
Loading…
Add table
Reference in a new issue