Module: check_mk
Branch: master
Commit: 41be302606a7b08cb4ca41adbc2dc9f95a31d419
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=41be302606a7b0…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Jul 13 08:37:27 2018 +0200
Use pylint's job feature.
Change-Id: I8075d2c9ecd45a4a2dc45b9821e3675d1fa567a2
---
tests/testlib/pylint_cmk.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tests/testlib/pylint_cmk.py b/tests/testlib/pylint_cmk.py
index 6f3d524..486bcaf 100644
--- a/tests/testlib/pylint_cmk.py
+++ b/tests/testlib/pylint_cmk.py
@@ -4,6 +4,7 @@
import os
import sys
import glob
+import multiprocessing
import shutil
import subprocess
import tempfile
@@ -54,6 +55,7 @@ def run_pylint(base_path, check_files=None): #,
cleanup_test_dir=False):
cmd = [
"python", "-m", "pylint",
"--rcfile", pylint_cfg,
+ "--jobs=%d" % num_jobs_to_use(),
] + pylint_args + check_files
os.putenv("TEST_PATH", repo_path() + "/tests")
@@ -70,6 +72,13 @@ def run_pylint(base_path, check_files=None): #,
cleanup_test_dir=False):
return exit_code
+def num_jobs_to_use():
+ # Naive heuristic, but looks OK for our use cases: Normal quad core CPUs
+ # with HT report 8 CPUs (=> 6 jobs), our server 24-core CPU reports 48 CPUs
+ # (=> 11 jobs). Just using 0 (meaning: use all reported CPUs) might just
+ # work, too, but it's probably a bit too much.
+ return multiprocessing.cpu_count() / 8 + 5
+
def get_pylint_files(base_path, file_pattern):
files = []