Skip to content
Snippets Groups Projects
Commit 2d7fb61d authored by knownexus's avatar knownexus Committed by Jürg Billeter
Browse files

Max-jobs is now defined on a platform basis

This is due to Darwin (MacOS) having a different Max-Jobs limit
_platform/platform.py: Adding max-jobs call

_project.py: redirected 'max-jobs' to point at the platform
parent e850b656
No related branches found
No related tags found
No related merge requests found
......@@ -63,6 +63,9 @@ class Platform():
cls._create_instance()
return cls._instance
def get_cpu_count(self, cap=None):
return min(len(os.sched_getaffinity(0)), cap)
##################################################################
# Sandbox functions #
##################################################################
......
......@@ -38,6 +38,7 @@ from ._loader import Loader
from .element import Element
from ._message import Message, MessageType
from ._includes import Includes
from ._platform import Platform
# Project Configuration file
......@@ -617,7 +618,8 @@ 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))
platform = Platform.get_platform()
output.base_variables['max-jobs'] = str(platform.get_cpu_count(8))
# Export options into variables, if that was requested
output.options.export_variables(output.base_variables)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment