mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-31 10:11:17 +00:00
fw/config: add resource getter to run config
Track resource getter configuration as part of the run config.
This commit is contained in:
parent
a062a39f78
commit
bcea1bd0af
@ -701,9 +701,11 @@ class RunConfiguration(Configuration):
|
|||||||
|
|
||||||
device_config = pod.pop('device_config', None)
|
device_config = pod.pop('device_config', None)
|
||||||
augmentations = pod.pop('augmentations', {})
|
augmentations = pod.pop('augmentations', {})
|
||||||
|
getters = pod.pop('resource_getters', {})
|
||||||
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
|
instance.augmentations = augmentations
|
||||||
|
instance.resource_getters = getters
|
||||||
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])
|
||||||
|
|
||||||
@ -715,6 +717,7 @@ class RunConfiguration(Configuration):
|
|||||||
confpoint.set_value(self, check_mandatory=False)
|
confpoint.set_value(self, check_mandatory=False)
|
||||||
self.device_config = None
|
self.device_config = None
|
||||||
self.augmentations = {}
|
self.augmentations = {}
|
||||||
|
self.resource_getters = {}
|
||||||
|
|
||||||
def merge_device_config(self, plugin_cache):
|
def merge_device_config(self, plugin_cache):
|
||||||
"""
|
"""
|
||||||
@ -733,10 +736,16 @@ class RunConfiguration(Configuration):
|
|||||||
raise ValueError('Augmentation "{}" already added.'.format(aug.name))
|
raise ValueError('Augmentation "{}" already added.'.format(aug.name))
|
||||||
self.augmentations[aug.name] = aug.get_config()
|
self.augmentations[aug.name] = aug.get_config()
|
||||||
|
|
||||||
|
def add_resource_getter(self, getter):
|
||||||
|
if getter.name in self.resource_getters:
|
||||||
|
raise ValueError('Resource getter "{}" already added.'.format(getter.name))
|
||||||
|
self.resource_getters[getter.name] = getter.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
|
pod['augmentations'] = self.augmentations
|
||||||
|
pod['resource_getters'] = self.resource_getters
|
||||||
return pod
|
return pod
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,15 +100,13 @@ class ExecutionContext(object):
|
|||||||
self.tm = tm
|
self.tm = tm
|
||||||
self.run_output = output
|
self.run_output = output
|
||||||
self.run_state = output.state
|
self.run_state = output.state
|
||||||
self.logger.debug('Loading resource discoverers')
|
|
||||||
self.resolver = ResourceResolver(cm.plugin_cache)
|
|
||||||
self.resolver.load()
|
|
||||||
self.job_queue = None
|
self.job_queue = None
|
||||||
self.completed_jobs = None
|
self.completed_jobs = None
|
||||||
self.current_job = None
|
self.current_job = None
|
||||||
self.successful_jobs = 0
|
self.successful_jobs = 0
|
||||||
self.failed_jobs = 0
|
self.failed_jobs = 0
|
||||||
self.run_interrupted = False
|
self.run_interrupted = False
|
||||||
|
self._load_resource_getters()
|
||||||
|
|
||||||
def start_run(self):
|
def start_run(self):
|
||||||
self.output.info.start_time = datetime.utcnow()
|
self.output.info.start_time = datetime.utcnow()
|
||||||
@ -298,6 +296,13 @@ class ExecutionContext(object):
|
|||||||
|
|
||||||
self.job_queue = new_queue
|
self.job_queue = new_queue
|
||||||
|
|
||||||
|
def _load_resource_getters(self):
|
||||||
|
self.logger.debug('Loading resource discoverers')
|
||||||
|
self.resolver = ResourceResolver(self.cm.plugin_cache)
|
||||||
|
self.resolver.load()
|
||||||
|
for getter in self.resolver.getters:
|
||||||
|
self.cm.run_config.add_resource_getter(getter)
|
||||||
|
|
||||||
def _get_unique_filepath(self, filename):
|
def _get_unique_filepath(self, filename):
|
||||||
filepath = os.path.join(self.output_directory, filename)
|
filepath = os.path.join(self.output_directory, filename)
|
||||||
rest, ext = os.path.splitext(filepath)
|
rest, ext = os.path.splitext(filepath)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user