mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-18 12:06:08 +00:00
Load RuntimeConfig from plugins
Implements support for dynamically loading additional RuntimeConfig and associated RuntimeParameter that are defined in a plugin. Currently, the various RuntimeConfig's are hard coded in a list within WA. This patch extends RuntimeParameterManager to use PluginLoader to load RuntimeConfig classes and append to the hard coded list. The implementation, as written, does not allow loading RuntimeConfig from a plugin if it has the same name as one of the hard coded RuntimeConfig. This is meant to prevent conflicts and unexpected behavior.
This commit is contained in:
parent
48152224a8
commit
a3eacb877c
@ -22,6 +22,7 @@ from wa.framework.target.runtime_config import (SysfileValuesRuntimeConfig,
|
|||||||
CpuidleRuntimeConfig,
|
CpuidleRuntimeConfig,
|
||||||
AndroidRuntimeConfig)
|
AndroidRuntimeConfig)
|
||||||
from wa.utils.types import obj_dict, caseless_string
|
from wa.utils.types import obj_dict, caseless_string
|
||||||
|
from wa.framework import pluginloader
|
||||||
|
|
||||||
|
|
||||||
class RuntimeParameterManager(object):
|
class RuntimeParameterManager(object):
|
||||||
@ -37,9 +38,16 @@ class RuntimeParameterManager(object):
|
|||||||
|
|
||||||
def __init__(self, target):
|
def __init__(self, target):
|
||||||
self.target = target
|
self.target = target
|
||||||
self.runtime_configs = [cls(self.target) for cls in self.runtime_config_cls]
|
|
||||||
self.runtime_params = {}
|
self.runtime_params = {}
|
||||||
|
|
||||||
|
try:
|
||||||
|
for rt_cls in pluginloader.list_plugins(kind='runtime-config'):
|
||||||
|
if rt_cls not in self.runtime_config_cls:
|
||||||
|
self.runtime_config_cls.append(rt_cls)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
self.runtime_configs = [cls(self.target) for cls in self.runtime_config_cls]
|
||||||
|
|
||||||
runtime_parameter = namedtuple('RuntimeParameter', 'cfg_point, rt_config')
|
runtime_parameter = namedtuple('RuntimeParameter', 'cfg_point, rt_config')
|
||||||
for cfg in self.runtime_configs:
|
for cfg in self.runtime_configs:
|
||||||
for param in cfg.supported_parameters:
|
for param in cfg.supported_parameters:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user