From 9573edb4ebc8af68002f499f54da3616a1bfaa48 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 28 Mar 2017 19:37:39 +1100 Subject: [PATCH] Run mlock_report under python3 psutil is only installed under python3 for the 3.5 gate jobs. Call mlock_report.py with $PYTHON so we support both environments. Updates to mlock_report.py for python3 compatability Change-Id: If7926ce6a2996b766c49b010a7f6640ae624f860 --- tools/memory_tracker.sh | 4 +++- tools/mlock_report.py | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/memory_tracker.sh b/tools/memory_tracker.sh index 7397c03941..cbdeb8f420 100755 --- a/tools/memory_tracker.sh +++ b/tools/memory_tracker.sh @@ -14,6 +14,8 @@ set -o errexit +PYTHON=${PYTHON:-python} + # time to sleep between checks SLEEP_TIME=20 @@ -86,7 +88,7 @@ function tracker { # list processes that lock memory from swap if [[ $unevictable -ne $unevictable_point ]]; then unevictable_point=$unevictable - ./tools/mlock_report.py + ${PYTHON} ./tools/mlock_report.py fi echo "]]]" diff --git a/tools/mlock_report.py b/tools/mlock_report.py index 1d23af90d7..2169cc2dce 100755 --- a/tools/mlock_report.py +++ b/tools/mlock_report.py @@ -8,14 +8,15 @@ import subprocess import psutil -SUMMARY_REGEX = re.compile(r".*\s+(?P[\d]+)\s+KB") +SUMMARY_REGEX = re.compile(b".*\s+(?P[\d]+)\s+KB") def main(): try: - print _get_report() + print(_get_report()) except Exception as e: - print "Failure listing processes locking memory: %s" % str(e) + print("Failure listing processes locking memory: %s" % str(e)) + raise def _get_report():