diff options
author | Benjamin Schubert <contact@benschubert.me> | 2019-06-11 07:55:21 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-07-15 14:14:02 +0000 |
commit | 4a56ebe6e589e2aa5d8da3fc2b76f76a19aa03b7 (patch) | |
tree | ffbdb49a64bd27f0ce0d9e421170a60f6db6706d /src/buildstream/_context.py | |
parent | d14b809cc7b56b7be9e3e40c2e12e8f7245ba680 (diff) | |
download | buildstream-4a56ebe6e589e2aa5d8da3fc2b76f76a19aa03b7.tar.gz |
_yaml: Add 'as_int()' on ScalarNode
- Add the 'as_int()' method on 'ScalarNode' to replace
'node_get(mapping, key, int)'
- Adapt all call sites to use the new API
Diffstat (limited to 'src/buildstream/_context.py')
-rw-r--r-- | src/buildstream/_context.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/buildstream/_context.py b/src/buildstream/_context.py index 0510bb9a7..331be7e3e 100644 --- a/src/buildstream/_context.py +++ b/src/buildstream/_context.py @@ -289,11 +289,12 @@ class Context(): 'error-lines', 'message-lines', 'debug', 'element-format', 'message-format' ]) - self.log_key_length = _yaml.node_get(logging, int, 'key-length') + self.log_key_length = logging.get_int('key-length') self.log_debug = logging.get_bool('debug') self.log_verbose = logging.get_bool('verbose') - self.log_error_lines = _yaml.node_get(logging, int, 'error-lines') - self.log_message_lines = _yaml.node_get(logging, int, 'message-lines') + self.log_error_lines = logging.get_int('error-lines') + self.log_message_lines = logging.get_int('message-lines') + self.log_message_lines = logging.get_int('message-lines') self.log_element_format = logging.get_str('element-format') self.log_message_format = logging.get_str('message-format') @@ -305,10 +306,10 @@ class Context(): ]) self.sched_error_action = _node_get_option_str( scheduler, 'on-error', ['continue', 'quit', 'terminate']) - self.sched_fetchers = _yaml.node_get(scheduler, int, 'fetchers') - self.sched_builders = _yaml.node_get(scheduler, int, 'builders') - self.sched_pushers = _yaml.node_get(scheduler, int, 'pushers') - self.sched_network_retries = _yaml.node_get(scheduler, int, 'network-retries') + self.sched_fetchers = scheduler.get_int('fetchers') + self.sched_builders = scheduler.get_int('builders') + self.sched_pushers = scheduler.get_int('pushers') + self.sched_network_retries = scheduler.get_int('network-retries') # Load per-projects overrides self._project_overrides = defaults.get_mapping('projects', default={}) |