[FIX] server: support psutils >= 4.0

In version 3, process.memory_info() returns only rss and vms
In version 4, it now returns rss, vms, shared, text, lib, data and dirty
Automatic unpacking is no longer possible in 4.0

Fixes #11052, Closes #11459
This commit is contained in:
Stephen Medina 2016-03-23 13:57:39 -07:00 committed by Martin Trigaux
parent 58d99909ec
commit 92f1cbeb6f
No known key found for this signature in database
GPG Key ID: 7B0E288E7C0F83A7
1 changed files with 2 additions and 1 deletions

View File

@ -47,7 +47,8 @@ SLEEP_INTERVAL = 60 # 1 min
def memory_info(process):
""" psutil < 2.0 does not have memory_info, >= 3.0 does not have
get_memory_info """
return (getattr(process, 'memory_info', None) or process.get_memory_info)()
pmem = (getattr(process, 'memory_info', None) or process.get_memory_info)()
return (pmem.rss, pmem.vms)
#----------------------------------------------------------
# Werkzeug WSGI servers patched