mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-22 04:49:00 +00:00
Misc fixes & improvements
This commit is contained in:
parent
49576e5701
commit
a347ea7d61
@ -17,7 +17,8 @@ from wlauto.core.configuration import settings # NOQA
|
|||||||
from wlauto.core.device_manager import DeviceManager, RuntimeParameter, CoreParameter # NOQA
|
from wlauto.core.device_manager import DeviceManager, RuntimeParameter, CoreParameter # NOQA
|
||||||
from wlauto.core.command import Command # NOQA
|
from wlauto.core.command import Command # NOQA
|
||||||
from wlauto.core.workload import Workload # 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
|
import wlauto.core.pluginloader as PluginLoader # NOQA
|
||||||
from wlauto.core.instrumentation import Instrument # NOQA
|
from wlauto.core.instrumentation import Instrument # NOQA
|
||||||
from wlauto.core.result import ResultProcessor, IterationResult # NOQA
|
from wlauto.core.result import ResultProcessor, IterationResult # NOQA
|
||||||
|
@ -832,7 +832,7 @@ class JobSpec(Configuration):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(JobSpec, self).__init__()
|
super(JobSpec, self).__init__()
|
||||||
self._to_merge = defaultdict(dict)
|
self.to_merge = defaultdict(OrderedDict)
|
||||||
self._sources = []
|
self._sources = []
|
||||||
self.id = None
|
self.id = None
|
||||||
self.workload_parameters = None
|
self.workload_parameters = None
|
||||||
@ -847,7 +847,7 @@ class JobSpec(Configuration):
|
|||||||
continue
|
continue
|
||||||
elif k in ["workload_parameters", "runtime_parameters", "boot_parameters"]:
|
elif k in ["workload_parameters", "runtime_parameters", "boot_parameters"]:
|
||||||
if v:
|
if v:
|
||||||
self._to_merge[k][source] = copy(v)
|
self.to_merge[k][source] = copy(v)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
self.set(k, v, check_mandatory=check_mandatory)
|
self.set(k, v, check_mandatory=check_mandatory)
|
||||||
@ -867,8 +867,8 @@ class JobSpec(Configuration):
|
|||||||
# TODO: Wrap in - "error in [agenda path]"
|
# TODO: Wrap in - "error in [agenda path]"
|
||||||
cfg_points = plugin_cache.get_plugin_parameters(self.workload_name)
|
cfg_points = plugin_cache.get_plugin_parameters(self.workload_name)
|
||||||
for source in self._sources:
|
for source in self._sources:
|
||||||
if source in self._to_merge["workload_params"]:
|
if source in self.to_merge["workload_params"]:
|
||||||
config = self._to_merge["workload_params"][source]
|
config = self.to_merge["workload_params"][source]
|
||||||
for name, cfg_point in cfg_points.iteritems():
|
for name, cfg_point in cfg_points.iteritems():
|
||||||
if name in config:
|
if name in config:
|
||||||
value = config.pop(name)
|
value = config.pop(name)
|
||||||
@ -916,7 +916,7 @@ class JobSpec(Configuration):
|
|||||||
msg = 'No value specified for mandatory parameter "{}}".'
|
msg = 'No value specified for mandatory parameter "{}}".'
|
||||||
raise ConfigError(msg.format(e.args[0]))
|
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
|
# TODO: validate parameters and construct the rest of the instance
|
||||||
|
|
||||||
@ -958,6 +958,8 @@ class JobGenerator(object):
|
|||||||
def set_global_value(self, name, value):
|
def set_global_value(self, name, value):
|
||||||
JobSpec.configuration[name].set_value(self.job_spec_template, value,
|
JobSpec.configuration[name].set_value(self.job_spec_template, value,
|
||||||
check_mandatory=False)
|
check_mandatory=False)
|
||||||
|
if name == "instrumentation":
|
||||||
|
self.update_enabled_instruments(value)
|
||||||
|
|
||||||
def add_section(self, section, workloads):
|
def add_section(self, section, workloads):
|
||||||
new_node = self.root_node.add_section(section)
|
new_node = self.root_node.add_section(section)
|
||||||
|
@ -261,13 +261,15 @@ class AgendaParser(object):
|
|||||||
# TODO: Error handling for workload errors vs section errors ect
|
# TODO: Error handling for workload errors vs section errors ect
|
||||||
for workload in global_workloads:
|
for workload in global_workloads:
|
||||||
self.jobs_config.add_workload(_process_workload_entry(workload,
|
self.jobs_config.add_workload(_process_workload_entry(workload,
|
||||||
seen_workload_ids))
|
seen_workload_ids,
|
||||||
|
self.jobs_config))
|
||||||
|
|
||||||
for section in sections:
|
for section in sections:
|
||||||
workloads = []
|
workloads = []
|
||||||
for workload in section.pop("workloads", []):
|
for workload in section.pop("workloads", []):
|
||||||
workloads.append(_process_workload_entry(workload,
|
workloads.append(_process_workload_entry(workload,
|
||||||
seen_workload_ids))
|
seen_workload_ids,
|
||||||
|
self.jobs_config))
|
||||||
|
|
||||||
_resolve_params_alias(section, seen_section_ids)
|
_resolve_params_alias(section, seen_section_ids)
|
||||||
section = _construct_valid_entry(section, seen_section_ids, "s", self.jobs_config)
|
section = _construct_valid_entry(section, seen_section_ids, "s", self.jobs_config)
|
||||||
@ -279,7 +281,6 @@ class AgendaParser(object):
|
|||||||
|
|
||||||
|
|
||||||
class EnvironmentVarsParser(object):
|
class EnvironmentVarsParser(object):
|
||||||
#TODO: podable
|
|
||||||
def __init__(self, wa_config, environ):
|
def __init__(self, wa_config, environ):
|
||||||
user_directory = environ.pop('WA_USER_DIRECTORY', '')
|
user_directory = environ.pop('WA_USER_DIRECTORY', '')
|
||||||
if user_directory:
|
if user_directory:
|
||||||
@ -296,8 +297,7 @@ class EnvironmentVarsParser(object):
|
|||||||
# certain arguments to the correct configuration points and keep a record of
|
# certain arguments to the correct configuration points and keep a record of
|
||||||
# how WA was invoked
|
# how WA was invoked
|
||||||
class CommandLineArgsParser(object):
|
class CommandLineArgsParser(object):
|
||||||
#TODO: podable
|
def __init__(self, cmd_args, wa_config, jobs_config):
|
||||||
def __init__(self, cmd_args, wa_config, run_config, jobs_config):
|
|
||||||
wa_config.set("verbosity", cmd_args.verbosity)
|
wa_config.set("verbosity", cmd_args.verbosity)
|
||||||
# TODO: Is this correct? Does there need to be a third output dir param
|
# 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])
|
disabled_instruments = toggle_set(["~{}".format(i) for i in cmd_args.instruments_to_disable])
|
||||||
|
@ -714,7 +714,6 @@ class PluginLoader(object):
|
|||||||
base_default_config = self.get_plugin_class(real_name).get_default_config()
|
base_default_config = self.get_plugin_class(real_name).get_default_config()
|
||||||
return merge_dicts_simple(base_default_config, alias_config)
|
return merge_dicts_simple(base_default_config, alias_config)
|
||||||
|
|
||||||
|
|
||||||
def list_plugins(self, kind=None):
|
def list_plugins(self, kind=None):
|
||||||
"""
|
"""
|
||||||
List discovered plugin classes. Optionally, only list plugins of a
|
List discovered plugin classes. Optionally, only list plugins of a
|
||||||
|
@ -414,7 +414,7 @@ class TestCommandLineArgsParser(TestCase):
|
|||||||
only_run_ids=["wk1", "s1_wk4"],
|
only_run_ids=["wk1", "s1_wk4"],
|
||||||
some_other_setting="value123"
|
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)
|
wa_config.set.assert_has_calls([call("verbosity", 1)], any_order=True)
|
||||||
jobs_config.disable_instruments.assert_has_calls([
|
jobs_config.disable_instruments.assert_has_calls([
|
||||||
call(toggle_set(["~abc", "~def", "~ghi"]))
|
call(toggle_set(["~abc", "~def", "~ghi"]))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user