gecko-dev/testing/mozbase/mozsystemmonitor
Gregory Szorc 63c60857b5 Bug 1116194 - Catch errors calling psutil; r=ted
The build system / mach currently has a very hacky virtualenv setup.
Essentially, it resorts to sys.path munging instead of a proper,
isolated environment.

During initialization, mach installs python/psutil in sys.path. Later
on, some code does an |import psutil|. This fails iff the psutil C
extension can't be found.

If there is a psutil C extension installed outside of mach and
python/psutil, |import psutil| may load it. The version mismatch isn't
detected until an extension-using psutil API is called. This has
manifested inside |mach build| via the resource monitor as an
|AttributeError: 'module' object has no attribute 'linux_sysinfo'|
exception during psutil.virtual_memory().

The proper fix for this is for the Python environment to ensure the
psutil C extension is built before attempting to import and use psutil.
Arguably, psutil itself should perform some kind of version check when
it imports the C extension to ensure things are in sync and fail at
import time.

Fixing mach and the build system Python environment to build psutil
earlier/properly is a long outstanding bug. It needs to be addressed.
But it is considerable effort. This patch continues the long history of
wallpapering over psutil import/run failures because using a proper
virutalenv from mach/build system is a lot of work. Sad panda.

--HG--
extra : rebase_source : 5c449d69c0fd907ea8359ac721ef6287baa4f10e
2014-12-29 12:06:21 -08:00
..
mozsystemmonitor Bug 1116194 - Catch errors calling psutil; r=ted 2014-12-29 12:06:21 -08:00
README.rst
setup.py Bug 1035006 - Fix pyflakes warnings in mozbase.;r=wlach 2014-07-07 14:51:34 -04:00

README.rst

================
mozsystemmonitor
================

mozsystemmonitor contains modules for monitoring a running system.

SystemResourceMonitor
=====================

mozsystemmonitor.resourcemonitor.SystemResourceMonitor is class used to
measure system resource usage. It is useful to get a handle on what an
overall system is doing.