diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-07-14 20:11:40 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-07-14 20:23:27 +0900 |
commit | 32a4ebbfa9045c305fae4b701947cf6386d121c6 (patch) | |
tree | 8f3caa22212628f909263d470ea5d0026f992939 | |
parent | 6ed6317ef0f91012d9924db63841f94ed5343085 (diff) | |
download | buildstream-32a4ebbfa9045c305fae4b701947cf6386d121c6.tar.gz |
_context.py: Added max-jobs configuration
This loads the configuration of the max-jobs variable
from the user configuration, where the default is 0
(meaning use the maximum number of cores with a limit of 8).
This is a part of #1033
-rw-r--r-- | buildstream/_context.py | 10 | ||||
-rw-r--r-- | buildstream/data/userconfig.yaml | 14 |
2 files changed, 23 insertions, 1 deletions
diff --git a/buildstream/_context.py b/buildstream/_context.py index 997b82959..8a7cec70c 100644 --- a/buildstream/_context.py +++ b/buildstream/_context.py @@ -104,6 +104,9 @@ class Context(): # What to do when a build fails in non interactive mode self.sched_error_action = 'continue' + # Maximum jobs per build + self.build_max_jobs = None + # Whether elements must be rebuilt when their dependencies have changed self._strict_build_plan = None @@ -161,7 +164,7 @@ class Context(): _yaml.node_validate(defaults, [ 'sourcedir', 'builddir', 'artifactdir', 'logdir', 'scheduler', 'artifacts', 'logging', 'projects', - 'cache' + 'cache', 'build' ]) for directory in ['sourcedir', 'builddir', 'artifactdir', 'logdir']: @@ -213,6 +216,11 @@ class Context(): self.sched_pushers = _yaml.node_get(scheduler, int, 'pushers') self.sched_network_retries = _yaml.node_get(scheduler, int, 'network-retries') + # Load build config + build = _yaml.node_get(defaults, dict, 'build') + _yaml.node_validate(build, ['max-jobs']) + self.build_max_jobs = _yaml.node_get(build, int, 'max-jobs') + # Load per-projects overrides self._project_overrides = _yaml.node_get(defaults, Mapping, 'projects', default_value={}) diff --git a/buildstream/data/userconfig.yaml b/buildstream/data/userconfig.yaml index 5f9b01120..4711df5e0 100644 --- a/buildstream/data/userconfig.yaml +++ b/buildstream/data/userconfig.yaml @@ -58,6 +58,20 @@ scheduler: # +# Build related configuration +# +build: + + # + # Maximum number of jobs to run per build task. + # + # The default behavior when this is set to 0, is to use the + # maximum number of threads available, with a maximum of 8. + # + max-jobs: 0 + + +# # Logging # logging: |