summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-07-14 19:10:41 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-07-15 23:30:40 +0900
commitcadc772b9b7cd664420d094726035e1464aa12d1 (patch)
tree9254cc57fbfc319af98600c249ffb5ecc766ad5f
parent0d4905220637bb3c49161d07834da4fa11d8af2c (diff)
downloadbuildstream-cadc772b9b7cd664420d094726035e1464aa12d1.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--src/buildstream/_context.py10
-rw-r--r--src/buildstream/data/userconfig.yaml14
2 files changed, 23 insertions, 1 deletions
diff --git a/src/buildstream/_context.py b/src/buildstream/_context.py
index 2bdf5b0b4..50989e590 100644
--- a/src/buildstream/_context.py
+++ b/src/buildstream/_context.py
@@ -120,6 +120,9 @@ class Context():
# What to do when a build fails in non interactive mode
self.sched_error_action = None
+ # Maximum jobs per build
+ self.build_max_jobs = None
+
# Size of the artifact cache in bytes
self.config_cache_quota = None
@@ -204,7 +207,7 @@ class Context():
"artifactdir is obsolete")
_yaml.node_validate(defaults, [
- 'cachedir', 'sourcedir', 'builddir', 'logdir', 'scheduler',
+ 'cachedir', 'sourcedir', 'builddir', 'logdir', 'scheduler', 'build',
'artifacts', 'source-caches', 'logging', 'projects', 'cache', 'prompt',
'workspacedir', 'remote-execution',
])
@@ -311,6 +314,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, dict, 'projects', default_value={})
diff --git a/src/buildstream/data/userconfig.yaml b/src/buildstream/data/userconfig.yaml
index 34fd300d1..a73c1ce44 100644
--- a/src/buildstream/data/userconfig.yaml
+++ b/src/buildstream/data/userconfig.yaml
@@ -78,6 +78,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: