summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Jardón <jjardon@gnome.org>2018-08-09 17:22:24 +0000
committerJavier Jardón <jjardon@gnome.org>2018-08-09 17:22:24 +0000
commitde955834683535cafc15c9d69f5a53e204df735f (patch)
tree052038eeee0a3c4a1c9dc07290e0b1904e7953d8
parentef7810f37bff2a85ad8d874b068121ac50b77801 (diff)
parent4e1488ee4849894f8476fc1fafcf6911d18b94a7 (diff)
downloadbuildstream-de955834683535cafc15c9d69f5a53e204df735f.tar.gz
Merge branch 'jjardon/max-jobs' into 'master'
buildstream/_project.py: Restrict max-jobs See merge request BuildStream/buildstream!620
-rw-r--r--buildstream/_project.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/buildstream/_project.py b/buildstream/_project.py
index a0f3a5059..951662e2b 100644
--- a/buildstream/_project.py
+++ b/buildstream/_project.py
@@ -19,7 +19,6 @@
# Tiago Gomes <tiago.gomes@codethink.co.uk>
import os
-import multiprocessing # for cpu_count()
from collections import Mapping, OrderedDict
from pluginbase import PluginBase
from . import utils
@@ -572,7 +571,10 @@ class Project():
# Extend variables with automatic variables and option exports
# Initialize it as a string as all variables are processed as strings.
- output.base_variables['max-jobs'] = str(multiprocessing.cpu_count())
+ # Based on some testing (mainly on AWS), maximum effective
+ # max-jobs value seems to be around 8-10 if we have enough cores
+ # users should set values based on workload and build infrastructure
+ output.base_variables['max-jobs'] = str(min(len(os.sched_getaffinity(0)), 8))
# Export options into variables, if that was requested
output.options.export_variables(output.base_variables)