aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammed Naser <mnaser@vexxhost.com>2017-03-16 15:10:35 -0400
committerMohammed Naser <mnaser@vexxhost.com>2017-03-20 16:55:47 -0400
commit4f84f3d15c999611aa56151fe9f572aec05c10bd (patch)
treed46e4069cdbf63f016161d3513ab76fab9984685
parentac1d2df3b899d50f62c106620fb9e3e4888046ed (diff)
downloadkolla-4f84f3d15c999611aa56151fe9f572aec05c10bd.tar.gz
kolla-4f84f3d15c999611aa56151fe9f572aec05c10bd.zip
Speed up builds by increasing threads for builds
Generally, OpenStack CI infrastructure workers will typically have 8 cores therefore by hardcoding the threads to 4, we miss out on valuable CPU power that can speed up builds. This patch sets the number of threads when running tests between the higher number of 4 (original value) or the number of CPU cores. Change-Id: I857507d08d91ddb5e0bccb118d15f2e2bcf4da99
-rw-r--r--tests/test_build.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/test_build.py b/tests/test_build.py
index 260e12e97..b70583748 100644
--- a/tests/test_build.py
+++ b/tests/test_build.py
@@ -11,6 +11,7 @@
# under the License.
import abc
+import multiprocessing
import os
import sys
@@ -34,7 +35,12 @@ class BuildTest(object):
super(BuildTest, self).setUp()
self.useFixture(log_fixture.SetLogLevel([__name__],
logging.logging.INFO))
- self.build_args = [__name__, "--debug", '--threads', '4']
+
+ self.threads = multiprocessing.cpu_count()
+ if self.threads < 4:
+ self.threads = 4
+
+ self.build_args = [__name__, "--debug", '--threads', str(self.threads)]
@testtools.skipUnless(os.environ.get('DOCKER_BUILD_TEST'),
'Skip the docker build test')