Phillip Smyth pushed to branch mac_fixes at BuildStream / buildstream
Commits:
- 
af1f58f9
by knownexus at 2018-08-30T14:33:12Z
3 changed files:
Changes:
| ... | ... | @@ -49,3 +49,6 @@ class Darwin(Platform): | 
| 49 | 49 |  | 
| 50 | 50 |      def create_sandbox(self, *args, **kwargs):
 | 
| 51 | 51 |          return SandboxChroot(*args, **kwargs)
 | 
| 52 | + | |
| 53 | +     def get_cpu_count(self):
 | |
| 54 | +        return str(min(len(os.cpu_count()))) | 
| ... | ... | @@ -96,3 +96,6 @@ class Platform(): | 
| 96 | 96 |      def create_sandbox(self, *args, **kwargs):
 | 
| 97 | 97 |          raise ImplError("Platform {platform} does not implement create_sandbox()"
 | 
| 98 | 98 |                          .format(platform=type(self).__name__))
 | 
| 99 | + | |
| 100 | +    def get_cpu_count(self):
 | |
| 101 | +        return str(min(len(os.sched_getaffinity(0)), 8)) | 
| ... | ... | @@ -19,6 +19,7 @@ | 
| 19 | 19 |  #        Tiago Gomes <tiago gomes codethink co uk>
 | 
| 20 | 20 |  | 
| 21 | 21 |  import os
 | 
| 22 | +import sys
 | |
| 22 | 23 |  from collections import Mapping, OrderedDict
 | 
| 23 | 24 |  from pluginbase import PluginBase
 | 
| 24 | 25 |  from . import utils
 | 
| ... | ... | @@ -38,6 +39,7 @@ from ._loader import Loader | 
| 38 | 39 |  from .element import Element
 | 
| 39 | 40 |  from ._message import Message, MessageType
 | 
| 40 | 41 |  from ._includes import Includes
 | 
| 42 | +from ._platform import Platform
 | |
| 41 | 43 |  | 
| 42 | 44 |  | 
| 43 | 45 |  # Project Configuration file
 | 
| ... | ... | @@ -594,7 +596,7 @@ class Project(): | 
| 594 | 596 |          # Based on some testing (mainly on AWS), maximum effective
 | 
| 595 | 597 |          # max-jobs value seems to be around 8-10 if we have enough cores
 | 
| 596 | 598 |          # users should set values based on workload and build infrastructure
 | 
| 597 | -        output.base_variables['max-jobs'] = str(min(len(os.sched_getaffinity(0)), 8))
 | |
| 599 | +        output.base_variables['max-jobs'] = Platform.get_cpu_count()
 | |
| 598 | 600 |  | 
| 599 | 601 |          # Export options into variables, if that was requested
 | 
| 600 | 602 |          output.options.export_variables(output.base_variables)
 | 
