1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-31 10:11:17 +00:00

Merge pull request #374 from marcbonnici/misc_fixes

Misc fixes
This commit is contained in:
setrofim 2017-03-22 17:40:12 +00:00 committed by GitHub
commit 044aef2535
4 changed files with 13 additions and 14 deletions

View File

@ -128,7 +128,7 @@ class LoggingConfig(dict):
self['color'] = config.pop('colour_enabled', self.defaults['color']) # legacy self['color'] = config.pop('colour_enabled', self.defaults['color']) # legacy
self['color'] = config.pop('color', self.defaults['color']) self['color'] = config.pop('color', self.defaults['color'])
if config: if config:
message = 'Unexpected logging configuation parameters: {}' message = 'Unexpected logging configuration parameters: {}'
raise ValueError(message.format(bad_vals=', '.join(config.keys()))) raise ValueError(message.format(bad_vals=', '.join(config.keys())))
elif config is None: elif config is None:
for k, v in self.defaults.iteritems(): for k, v in self.defaults.iteritems():
@ -267,7 +267,7 @@ class ConfigurationPoint(object):
article = get_article(typename) article = get_article(typename)
raise ConfigError(msg.format(value, self.name, article, typename)) raise ConfigError(msg.format(value, self.name, article, typename))
if value is not None: if value is not None:
self.validate_value(obj.name, value) self.validate_value(self.name, value)
if self.merge and hasattr(obj, self.name): if self.merge and hasattr(obj, self.name):
value = merge_config_values(getattr(obj, self.name), value) value = merge_config_values(getattr(obj, self.name), value)
setattr(obj, self.name, value) setattr(obj, self.name, value)
@ -401,7 +401,7 @@ class RuntimeParameterManager(object):
""" """
Validate values that do not require a active device connection. Validate values that do not require a active device connection.
This method should also pop all runtime parameters meant for this manager This method should also pop all runtime parameters meant for this manager
from params, even if they are not beign statically validated. from params, even if they are not being statically validated.
""" """
pass pass
@ -743,7 +743,7 @@ class RunConfiguration(Configuration):
default=['FAILED', 'PARTIAL'], default=['FAILED', 'PARTIAL'],
allowed_values=Status.values[Status.RUNNING.value:], allowed_values=Status.values[Status.RUNNING.value:],
description=''' description='''
This is list of statuses on which a job will be cosidered to have This is list of statuses on which a job will be considered to have
failed and will be automatically retried up to ``max_retries`` failed and will be automatically retried up to ``max_retries``
times. This defaults to ``["FAILED", "PARTIAL"]`` if not set. times. This defaults to ``["FAILED", "PARTIAL"]`` if not set.
Possible values are:: Possible values are::
@ -758,7 +758,7 @@ class RunConfiguration(Configuration):
The workload itself has failed. The workload itself has failed.
``"ABORTED"`` ``"ABORTED"``
The user interupted the workload The user interrupted the workload
''', ''',
), ),
ConfigurationPoint( ConfigurationPoint(
@ -799,7 +799,7 @@ class RunConfiguration(Configuration):
""" """
# pylint: disable=no-member # pylint: disable=no-member
if self.device is None: if self.device is None:
msg = 'Attemting to merge device config with unspecified device' msg = 'Attempting to merge device config with unspecified device'
raise RuntimeError(msg) raise RuntimeError(msg)
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")
@ -1068,7 +1068,7 @@ def create_job_spec(workload_entry, sections, target_manager, plugin_cache,
# PHASE 2.2: Merge global, section and workload entry "workload_parameters" # PHASE 2.2: Merge global, section and workload entry "workload_parameters"
job_spec.merge_workload_parameters(plugin_cache) job_spec.merge_workload_parameters(plugin_cache)
# TODO: PHASE 2.3: Validate device runtime/boot paramerers # TODO: PHASE 2.3: Validate device runtime/boot parameters
job_spec.merge_runtime_parameters(plugin_cache, target_manager) job_spec.merge_runtime_parameters(plugin_cache, target_manager)
target_manager.validate_runtime_parameters(job_spec.runtime_parameters) target_manager.validate_runtime_parameters(job_spec.runtime_parameters)

View File

@ -155,7 +155,7 @@ class AgendaParser(object):
for section in sections: for section in sections:
workloads = [] workloads = []
for workload_entry in section.pop("workloads", []): for workload_entry in section.pop("workloads", []):
workload = _process_workload_entry(workload_entry, seen_workload_ids, workload = _process_workload_entry(workload_entry, seen_wkl_ids,
state.jobs_config) state.jobs_config)
workloads.append(workload) workloads.append(workload)
@ -224,8 +224,8 @@ def _pop_aliased(d, names, entry_id):
name_count = sum(1 for n in names if n in d) name_count = sum(1 for n in names if n in d)
if name_count > 1: if name_count > 1:
names_list = ', '.join(names) names_list = ', '.join(names)
msg = 'Inivalid workload entry "{}": at moust one of ({}}) must be specified.' msg = 'Invalid workload entry "{}": at most one of ({}}) must be specified.'
raise ConfigError(msg.format(workload_entry['id'], names_list)) raise ConfigError(msg.format(entry_id, names_list))
for name in names: for name in names:
if name in d: if name in d:
return d.pop(name) return d.pop(name)

View File

@ -155,7 +155,7 @@ class ApkFile(Resource):
version_matches = apk_version_matches(path, self.version) version_matches = apk_version_matches(path, self.version)
if self.variant is not None: if self.variant is not None:
name_matches = file_name_matches(path, self.variant) name_matches = file_name_matches(path, self.variant)
return name_matches and version_matches: return name_matches and version_matches
def __str__(self): def __str__(self):
text = '<{}\'s apk'.format(self.owner) text = '<{}\'s apk'.format(self.owner)

View File

@ -8,7 +8,7 @@ from wa.framework import pluginloader
from wa.framework.exception import PluginLoaderError from wa.framework.exception import PluginLoaderError
from wa.framework.plugin import Plugin, Parameter from wa.framework.plugin import Plugin, Parameter
from wa.utils.types import list_of_strings, list_of_ints from wa.utils.types import list_of_strings, list_of_ints
from wa.utils.misc import isiterable
def get_target_descriptions(loader=pluginloader): def get_target_descriptions(loader=pluginloader):
targets = {} targets = {}
@ -18,7 +18,7 @@ def get_target_descriptions(loader=pluginloader):
if desc.name in targets: if desc.name in targets:
msg = 'Duplicate target "{}" returned by {} and {}' msg = 'Duplicate target "{}" returned by {} and {}'
prev_dtor = targets[desc.name].source prev_dtor = targets[desc.name].source
raise PluginLoaderError(msg.format(dsc.name, prev_dtor.name, raise PluginLoaderError(msg.format(desc.name, prev_dtor.name,
descriptor.name)) descriptor.name))
targets[desc.name] = desc targets[desc.name] = desc
return targets.values() return targets.values()
@ -290,4 +290,3 @@ class DefaultTargetDescriptor(TargetDescriptor):
raise ValueError('Unexpected default "{}"'.format(name)) raise ValueError('Unexpected default "{}"'.format(name))
param_map[name].default = value param_map[name].default = value
return cls, param_map.values() return cls, param_map.values()