Fix psutil.cpu_times unpack error (#34318)

This commit is contained in:
Nicole Thomas 2016-06-27 18:25:58 -04:00 committed by GitHub
parent 1398b1c51e
commit e168b05a87

View File

@ -133,6 +133,8 @@ def top(num_processes=5, interval=3):
try:
process = psutil.Process(pid)
user, system = process.cpu_times()
except ValueError:
user, system, _, _ = process.cpu_times()
except psutil.NoSuchProcess:
continue
start_usage[process] = user + system
@ -141,6 +143,8 @@ def top(num_processes=5, interval=3):
for process, start in six.iteritems(start_usage):
try:
user, system = process.cpu_times()
except ValueError:
user, system, _, _ = process.cpu_times()
except psutil.NoSuchProcess:
continue
now = user + system