summaryrefslogtreecommitdiff
path: root/buildstream/_project.py
diff options
context:
space:
mode:
Diffstat (limited to 'buildstream/_project.py')
-rw-r--r--buildstream/_project.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/buildstream/_project.py b/buildstream/_project.py
index c9325174d..1660c4770 100644
--- a/buildstream/_project.py
+++ b/buildstream/_project.py
@@ -591,7 +591,12 @@ 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
- output.base_variables['max-jobs'] = str(min(len(os.sched_getaffinity(0)), 8))
+ if self._context.build_max_jobs == 0:
+ # User requested automatic max-jobs
+ output.base_variables['max-jobs'] = str(min(len(os.sched_getaffinity(0)), 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)