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
| ... | ... |
@@ -14,6 +14,8 @@ |
| 14 | 14 |
|
| 15 | 15 |
set -o errexit |
| 16 | 16 |
|
| 17 |
+PYTHON=${PYTHON:-python}
|
|
| 18 |
+ |
|
| 17 | 19 |
# time to sleep between checks |
| 18 | 20 |
SLEEP_TIME=20 |
| 19 | 21 |
|
| ... | ... |
@@ -86,7 +88,7 @@ function tracker {
|
| 86 | 86 |
# list processes that lock memory from swap |
| 87 | 87 |
if [[ $unevictable -ne $unevictable_point ]]; then |
| 88 | 88 |
unevictable_point=$unevictable |
| 89 |
- ./tools/mlock_report.py |
|
| 89 |
+ ${PYTHON} ./tools/mlock_report.py
|
|
| 90 | 90 |
fi |
| 91 | 91 |
|
| 92 | 92 |
echo "]]]" |
| ... | ... |
@@ -8,14 +8,15 @@ import subprocess |
| 8 | 8 |
import psutil |
| 9 | 9 |
|
| 10 | 10 |
|
| 11 |
-SUMMARY_REGEX = re.compile(r".*\s+(?P<locked>[\d]+)\s+KB") |
|
| 11 |
+SUMMARY_REGEX = re.compile(b".*\s+(?P<locked>[\d]+)\s+KB") |
|
| 12 | 12 |
|
| 13 | 13 |
|
| 14 | 14 |
def main(): |
| 15 | 15 |
try: |
| 16 |
- print _get_report() |
|
| 16 |
+ print(_get_report()) |
|
| 17 | 17 |
except Exception as e: |
| 18 |
- print "Failure listing processes locking memory: %s" % str(e) |
|
| 18 |
+ print("Failure listing processes locking memory: %s" % str(e))
|
|
| 19 |
+ raise |
|
| 19 | 20 |
|
| 20 | 21 |
|
| 21 | 22 |
def _get_report(): |