Commit e396521e 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 cc7197f4
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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                       #
    ##################################################################
+3 −1
Original line number Diff line number Diff line
@@ -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)