mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-11-04 09:02:12 +00:00 
			
		
		
		
	Configuration: Added global_aliase
Previously `aliases` was conflated with global_aliases. This commit fixes this. `global_alias`'s are a name that can be used in top level configuration and set the values of one or more plugin parameters that use the same global_alias. `aliases` is a list of alternative names for a configuration point. Currently this is only used for instrumentation/instruments and workload_name/name but in the future it will likely be used when parameters have to be renamed to be more meaningful but still maintain backward compatibility.
This commit is contained in:
		@@ -168,7 +168,8 @@ class ConfigurationPoint(object):
 | 
			
		||||
                 description=None,
 | 
			
		||||
                 constraint=None,
 | 
			
		||||
                 merge=False,
 | 
			
		||||
                 aliases=None):
 | 
			
		||||
                 aliases=None,
 | 
			
		||||
                 global_alias=None):
 | 
			
		||||
        """
 | 
			
		||||
        Create a new Parameter object.
 | 
			
		||||
 | 
			
		||||
@@ -216,6 +217,9 @@ class ConfigurationPoint(object):
 | 
			
		||||
                      ``merge_config_values`` documentation for details.
 | 
			
		||||
        :param aliases: Alternative names for the same configuration point.
 | 
			
		||||
                        These are largely for backwards compatibility.
 | 
			
		||||
        :param global_alias: An alias for this parameter that can be specified at
 | 
			
		||||
                            the global level. A global_alias can map onto many
 | 
			
		||||
                            ConfigurationPoints.
 | 
			
		||||
        """
 | 
			
		||||
        self.name = identifier(name)
 | 
			
		||||
        if kind in KIND_MAP:
 | 
			
		||||
@@ -235,6 +239,7 @@ class ConfigurationPoint(object):
 | 
			
		||||
        self.constraint = constraint
 | 
			
		||||
        self.merge = merge
 | 
			
		||||
        self.aliases = aliases or []
 | 
			
		||||
        self.global_alias = global_alias
 | 
			
		||||
 | 
			
		||||
        if self.default is not None:
 | 
			
		||||
            try:
 | 
			
		||||
@@ -243,9 +248,9 @@ class ConfigurationPoint(object):
 | 
			
		||||
                raise ValueError('Default value "{}" is not valid'.format(self.default))
 | 
			
		||||
 | 
			
		||||
    def match(self, name):
 | 
			
		||||
        if name == self.name:
 | 
			
		||||
        if name == self.name or name in self.aliases:
 | 
			
		||||
            return True
 | 
			
		||||
        elif name in self.aliases:
 | 
			
		||||
        elif name == self.global_alias:
 | 
			
		||||
            return True
 | 
			
		||||
        return False
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -44,9 +44,9 @@ class PluginCache(object):
 | 
			
		||||
        self._list_of_global_aliases = set()
 | 
			
		||||
        for plugin in self.loader.list_plugins():
 | 
			
		||||
            for param in plugin.parameters:
 | 
			
		||||
                if param.aliases:
 | 
			
		||||
                    self._global_alias_map[plugin.name][param.aliases] = param
 | 
			
		||||
                    self._list_of_global_aliases.add(param.aliases)
 | 
			
		||||
                if param.global_alias:
 | 
			
		||||
                    self._global_alias_map[plugin.name][param.global_alias] = param
 | 
			
		||||
                    self._list_of_global_aliases.add(param.global_alias)
 | 
			
		||||
 | 
			
		||||
    def add_source(self, source):
 | 
			
		||||
        if source in self.sources:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user