summaryrefslogtreecommitdiff
path: root/src/buildstream/_project.py
diff options
context:
space:
mode:
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)