mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-21 20:38:57 +00:00
framework/config: fix augmentations merging
Remllace merge_instruments_result_processors with merge_agumentations which is updated to properly merge the new unified "augmentations" configurations.
This commit is contained in:
parent
4f8bd00fe2
commit
e3d74fcd21
@ -41,7 +41,7 @@ class ConfigParser(object):
|
|||||||
if 'id' in raw:
|
if 'id' in raw:
|
||||||
raise ConfigError('"id" cannot be set globally')
|
raise ConfigError('"id" cannot be set globally')
|
||||||
|
|
||||||
merge_result_processors_instruments(raw)
|
merge_augmentations(raw)
|
||||||
|
|
||||||
# Get WA core configuration
|
# Get WA core configuration
|
||||||
for cfg_point in state.settings.configuration.itervalues():
|
for cfg_point in state.settings.configuration.itervalues():
|
||||||
@ -206,18 +206,37 @@ def _load_file(filepath, error_name):
|
|||||||
return raw
|
return raw
|
||||||
|
|
||||||
|
|
||||||
def merge_result_processors_instruments(raw):
|
def merge_augmentations(raw):
|
||||||
instr_config = JobSpec.configuration['augmentations']
|
"""
|
||||||
instruments = toggle_set(pop_aliased_param(instr_config, raw, default=[]))
|
Since, from configuration perspective, result processors and instrumens are
|
||||||
result_processors = toggle_set(raw.pop('result_processors', []))
|
handled identically, the configuration entries are now interchangeable. E.g. it is
|
||||||
if instruments and result_processors:
|
now valid to specify a result processor in instrumentation list. This is to make things
|
||||||
conflicts = instruments.conflicts_with(result_processors)
|
eassier for the users, as, from their perspective, the distinction is somewhat arbitrary.
|
||||||
if conflicts:
|
|
||||||
msg = '"instrumentation" and "result_processors" have '\
|
For backwards compatibility, both entries are still valid, and this
|
||||||
'conflicting entries: {}'
|
function merges them together into a single "augmentations" set, ensuring
|
||||||
entires = ', '.join('"{}"'.format(c.strip("~")) for c in conflicts)
|
that there are no conflicts between the entries.
|
||||||
raise ConfigError(msg.format(entires))
|
|
||||||
raw['augmentations'] = instruments.merge_with(result_processors)
|
"""
|
||||||
|
cfg_point = JobSpec.configuration['augmentations']
|
||||||
|
names = [cfg_point.name,] + cfg_point.aliases
|
||||||
|
|
||||||
|
entries = [toggle_set(raw.pop(n)) for n in names if n in raw]
|
||||||
|
|
||||||
|
# Make sure none of the specified aliases conflict with each other
|
||||||
|
to_check = [e for e in entries]
|
||||||
|
while len(to_check) > 1:
|
||||||
|
check_entry = to_check.pop()
|
||||||
|
for e in to_check:
|
||||||
|
conflicts = check_entry.conflicts_with(e)
|
||||||
|
if conflicts:
|
||||||
|
msg = '"{}" and "{}" have conflicting entries: {}'
|
||||||
|
conflict_string = ', '.join('"{}"'.format(c.strip("~"))
|
||||||
|
for c in conflicts)
|
||||||
|
raise ConfigError(msg.format(check_entry, e, conflict_string))
|
||||||
|
|
||||||
|
if entries:
|
||||||
|
raw['augmentations'] = reduce(lambda x, y: x.merge_with(y), entries)
|
||||||
|
|
||||||
|
|
||||||
def _pop_aliased(d, names, entry_id):
|
def _pop_aliased(d, names, entry_id):
|
||||||
@ -247,7 +266,7 @@ def _construct_valid_entry(raw, seen_ids, prefix, jobs_config):
|
|||||||
workload_entry['id'] = raw.pop('id')
|
workload_entry['id'] = raw.pop('id')
|
||||||
|
|
||||||
# Process instrumentation
|
# Process instrumentation
|
||||||
merge_result_processors_instruments(raw)
|
merge_augmentations(raw)
|
||||||
|
|
||||||
# Validate all workload_entry
|
# Validate all workload_entry
|
||||||
for name, cfg_point in JobSpec.configuration.iteritems():
|
for name, cfg_point in JobSpec.configuration.iteritems():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user