1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-03-22 10:38:37 +00:00

fw/config: add installed aug configs to run config

Track configuration used for installed augmentations inside RunConfig.
This commit is contained in:
Sergei Trofimov 2018-07-11 11:03:47 +01:00 committed by Marc Bonnici
parent b1a01f777f
commit a062a39f78
4 changed files with 14 additions and 0 deletions

View File

@ -700,8 +700,10 @@ class RunConfiguration(Configuration):
meta_pod[cfg_point.name] = pod.pop(cfg_point.name, None) meta_pod[cfg_point.name] = pod.pop(cfg_point.name, None)
device_config = pod.pop('device_config', None) device_config = pod.pop('device_config', None)
augmentations = pod.pop('augmentations', {})
instance = super(RunConfiguration, cls).from_pod(pod) instance = super(RunConfiguration, cls).from_pod(pod)
instance.device_config = device_config instance.device_config = device_config
instance.augmentations = augmentations
for cfg_point in cls.meta_data: for cfg_point in cls.meta_data:
cfg_point.set_value(instance, meta_pod[cfg_point.name]) cfg_point.set_value(instance, meta_pod[cfg_point.name])
@ -712,6 +714,7 @@ class RunConfiguration(Configuration):
for confpoint in self.meta_data: for confpoint in self.meta_data:
confpoint.set_value(self, check_mandatory=False) confpoint.set_value(self, check_mandatory=False)
self.device_config = None self.device_config = None
self.augmentations = {}
def merge_device_config(self, plugin_cache): def merge_device_config(self, plugin_cache):
""" """
@ -725,9 +728,15 @@ class RunConfiguration(Configuration):
self.device_config = plugin_cache.get_plugin_config(self.device, self.device_config = plugin_cache.get_plugin_config(self.device,
generic_name="device_config") generic_name="device_config")
def add_augmentation(self, aug):
if aug.name in self.augmentations:
raise ValueError('Augmentation "{}" already added.'.format(aug.name))
self.augmentations[aug.name] = aug.get_config()
def to_pod(self): def to_pod(self):
pod = super(RunConfiguration, self).to_pod() pod = super(RunConfiguration, self).to_pod()
pod['device_config'] = dict(self.device_config or {}) pod['device_config'] = dict(self.device_config or {})
pod['augmentations'] = self.augmentations
return pod return pod

View File

@ -191,6 +191,9 @@ class ExecutionContext(object):
def write_job_specs(self): def write_job_specs(self):
self.run_output.write_job_specs(self.cm.job_specs) self.run_output.write_job_specs(self.cm.job_specs)
def add_augmentation(self, aug):
self.cm.run_config.add_augmentation(aug)
def get_resource(self, resource, strict=True): def get_resource(self, resource, strict=True):
result = self.resolver.get(resource, strict) result = self.resolver.get(resource, strict)
if result is None: if result is None:

View File

@ -345,6 +345,7 @@ def install(instrument, context):
instrument.logger.context = context instrument.logger.context = context
installed.append(instrument) installed.append(instrument)
context.add_augmentation(instrument)
def uninstall(instrument): def uninstall(instrument):

View File

@ -60,6 +60,7 @@ class ProcessorManager(object):
self.logger.debug('Installing {}'.format(processor.name)) self.logger.debug('Installing {}'.format(processor.name))
processor.logger.context = context processor.logger.context = context
self.processors.append(processor) self.processors.append(processor)
context.add_augmentation(processor)
def disable_all(self): def disable_all(self):
for output_processor in self.processors: for output_processor in self.processors: