1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-01 19:02:31 +01:00

framework/configruation: fix mandatory workload parameters

PluginCache.get_plugin_config assumes that no more configuration is to
be processed, and therefore config is final. As such, it is validating
that mandatory parameters are set. This assumption is invalid for
workload_parameters, however, as those need to be resolved on per-spec
basis, and cannot be globally cached.

This commit adds a prameter for get_plugin_config that indicates whether
or not it should consider the config to be final.
This commit is contained in:
Sergei Trofimov
2017-09-19 15:56:12 +01:00
parent aec89a077e
commit c96181bed7
2 changed files with 19 additions and 15 deletions

View File

@@ -272,12 +272,12 @@ class ConfigurationPoint(object):
value = merge_config_values(getattr(obj, self.name), value)
setattr(obj, self.name, value)
def validate(self, obj):
def validate(self, obj, check_mandatory=True):
value = getattr(obj, self.name, None)
if value is not None:
self.validate_value(obj.name, value)
else:
if self.mandatory:
if check_mandatory and self.mandatory:
msg = 'No value specified for mandatory parameter "{}" in {}.'
raise ConfigError(msg.format(self.name, obj.name))
@@ -928,7 +928,8 @@ class JobSpec(Configuration):
def merge_workload_parameters(self, plugin_cache):
# merge global generic and specific config
workload_params = plugin_cache.get_plugin_config(self.workload_name,
generic_name="workload_parameters")
generic_name="workload_parameters",
is_final=False)
cfg_points = plugin_cache.get_plugin_parameters(self.workload_name)
for source in self._sources: