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

Misc fixes & improvements

This commit is contained in:
Sebastian Goscik 2016-09-20 16:59:31 +01:00
parent 49576e5701
commit a347ea7d61
5 changed files with 15 additions and 13 deletions

View File

@ -17,7 +17,8 @@ from wlauto.core.configuration import settings # NOQA
from wlauto.core.device_manager import DeviceManager, RuntimeParameter, CoreParameter # NOQA
from wlauto.core.command import Command # NOQA
from wlauto.core.workload import Workload # NOQA
from wlauto.core.plugin import Parameter, Artifact, Alias # NOQA
from wlauto.core.plugin import Artifact, Alias # NOQA
from wlauto.core.configuration.configuration import ConfigurationPoint as Parameter
import wlauto.core.pluginloader as PluginLoader # NOQA
from wlauto.core.instrumentation import Instrument # NOQA
from wlauto.core.result import ResultProcessor, IterationResult # NOQA

View File

@ -832,7 +832,7 @@ class JobSpec(Configuration):
def __init__(self):
super(JobSpec, self).__init__()
self._to_merge = defaultdict(dict)
self.to_merge = defaultdict(OrderedDict)
self._sources = []
self.id = None
self.workload_parameters = None
@ -847,7 +847,7 @@ class JobSpec(Configuration):
continue
elif k in ["workload_parameters", "runtime_parameters", "boot_parameters"]:
if v:
self._to_merge[k][source] = copy(v)
self.to_merge[k][source] = copy(v)
else:
try:
self.set(k, v, check_mandatory=check_mandatory)
@ -867,8 +867,8 @@ class JobSpec(Configuration):
# TODO: Wrap in - "error in [agenda path]"
cfg_points = plugin_cache.get_plugin_parameters(self.workload_name)
for source in self._sources:
if source in self._to_merge["workload_params"]:
config = self._to_merge["workload_params"][source]
if source in self.to_merge["workload_params"]:
config = self.to_merge["workload_params"][source]
for name, cfg_point in cfg_points.iteritems():
if name in config:
value = config.pop(name)
@ -916,7 +916,7 @@ class JobSpec(Configuration):
msg = 'No value specified for mandatory parameter "{}}".'
raise ConfigError(msg.format(e.args[0]))
instance = super(JobSpec, cls).from_pod(pod, plugin_loader)
instance = super(JobSpec, cls).from_pod(pod, plugin_cache)
# TODO: validate parameters and construct the rest of the instance
@ -958,6 +958,8 @@ class JobGenerator(object):
def set_global_value(self, name, value):
JobSpec.configuration[name].set_value(self.job_spec_template, value,
check_mandatory=False)
if name == "instrumentation":
self.update_enabled_instruments(value)
def add_section(self, section, workloads):
new_node = self.root_node.add_section(section)

View File

@ -261,13 +261,15 @@ class AgendaParser(object):
# TODO: Error handling for workload errors vs section errors ect
for workload in global_workloads:
self.jobs_config.add_workload(_process_workload_entry(workload,
seen_workload_ids))
seen_workload_ids,
self.jobs_config))
for section in sections:
workloads = []
for workload in section.pop("workloads", []):
workloads.append(_process_workload_entry(workload,
seen_workload_ids))
seen_workload_ids,
self.jobs_config))
_resolve_params_alias(section, seen_section_ids)
section = _construct_valid_entry(section, seen_section_ids, "s", self.jobs_config)
@ -279,7 +281,6 @@ class AgendaParser(object):
class EnvironmentVarsParser(object):
#TODO: podable
def __init__(self, wa_config, environ):
user_directory = environ.pop('WA_USER_DIRECTORY', '')
if user_directory:
@ -296,8 +297,7 @@ class EnvironmentVarsParser(object):
# certain arguments to the correct configuration points and keep a record of
# how WA was invoked
class CommandLineArgsParser(object):
#TODO: podable
def __init__(self, cmd_args, wa_config, run_config, jobs_config):
def __init__(self, cmd_args, wa_config, jobs_config):
wa_config.set("verbosity", cmd_args.verbosity)
# TODO: Is this correct? Does there need to be a third output dir param
disabled_instruments = toggle_set(["~{}".format(i) for i in cmd_args.instruments_to_disable])

View File

@ -714,7 +714,6 @@ class PluginLoader(object):
base_default_config = self.get_plugin_class(real_name).get_default_config()
return merge_dicts_simple(base_default_config, alias_config)
def list_plugins(self, kind=None):
"""
List discovered plugin classes. Optionally, only list plugins of a

View File

@ -414,7 +414,7 @@ class TestCommandLineArgsParser(TestCase):
only_run_ids=["wk1", "s1_wk4"],
some_other_setting="value123"
)
CommandLineArgsParser(cmd_args, wa_config, run_config, jobs_config)
CommandLineArgsParser(cmd_args, wa_config, jobs_config)
wa_config.set.assert_has_calls([call("verbosity", 1)], any_order=True)
jobs_config.disable_instruments.assert_has_calls([
call(toggle_set(["~abc", "~def", "~ghi"]))