summaryrefslogtreecommitdiff
path: root/src/buildstream/_project.py
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-07-14 19:18:57 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-07-16 12:18:13 +0900
commit94f492598a6402a0ad05bdb682769c63f8206e29 (patch)
treeac86f424129f2eb03ce2e73d620e6c1a538db71f /src/buildstream/_project.py
parentc915c8b7c4f067346a03be597fd1451b2ceebc00 (diff)
downloadbuildstream-94f492598a6402a0ad05bdb682769c63f8206e29.tar.gz
_project.py: Use the user specified max-jobs
Only use automatic max-jobs by default if the user has not requested a specific value for max-jobs. This is a part of #1033
Diffstat (limited to 'src/buildstream/_project.py')
-rw-r--r--src/buildstream/_project.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/buildstream/_project.py b/src/buildstream/_project.py
index 97a2c4f77..a2ce5ae91 100644
--- a/src/buildstream/_project.py
+++ b/src/buildstream/_project.py
@@ -805,8 +805,13 @@ class Project():
# 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
- platform = Platform.get_platform()
- output.base_variables['max-jobs'] = str(platform.get_cpu_count(8))
+ if self._context.build_max_jobs == 0:
+ # User requested automatic max-jobs
+ platform = Platform.get_platform()
+ output.base_variables['max-jobs'] = str(platform.get_cpu_count(8))
+ else:
+ # User requested explicit max-jobs setting
+ output.base_variables['max-jobs'] = str(self._context.build_max_jobs)
# Export options into variables, if that was requested
output.options.export_variables(output.base_variables)