Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target Manager Parameter Updates #1109

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/build_plugin_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def generate_target_documentation(outdir):
text += get_params_rst(td.platform_params)
text += get_params_rst(td.target_params)
text += get_params_rst(td.assistant_params)
text += get_params_rst(td.tm_params)
wfh.write(text)


Expand Down
1 change: 1 addition & 0 deletions wa/commands/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def get_rst_from_target(target):
text += get_params_rst(target.platform_params)
text += get_params_rst(target.target_params)
text += get_params_rst(target.assistant_params)
text += get_params_rst(target.tm_params)
text += '.. Note: For available runtime parameters please see the documentation'
return text + '\n'

Expand Down
3 changes: 2 additions & 1 deletion wa/framework/configuration/plugin_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ def _set_from_global_aliases(self, plugin_name, config):

def _get_target_params(self, name):
td = self.targets[name]
return get_config_point_map(chain(td.target_params, td.platform_params, td.conn_params, td.assistant_params))
return get_config_point_map(chain(td.target_params, td.platform_params,
td.conn_params, td.assistant_params, td.tm_params))

# pylint: disable=too-many-nested-blocks, too-many-branches
def _merge_using_priority_specificity(self, specific_name,
Expand Down
4 changes: 2 additions & 2 deletions wa/framework/target/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ class AndroidAssistant(object):

Logcat buffer on android is of limited size and it cannot be
adjusted at run time. Depending on the amount of logging activity,
the buffer may not be enought to capture comlete trace for a
the buffer may not be enough to capture complete trace for a
workload execution. For those situations, logcat may be polled
periodically during the course of the run and stored in a
temporary locaiton on the host. Setting the value of the poll
temporary location on the host. Setting the value of the poll
period enables this behavior.
"""),
]
Expand Down
17 changes: 13 additions & 4 deletions wa/framework/target/descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#

import inspect
from itertools import chain

from devlib import (LinuxTarget, AndroidTarget, LocalLinuxTarget,
ChromeOsTarget, Platform, Juno, TC2, Gem5SimulationPlatform,
Expand Down Expand Up @@ -57,6 +58,7 @@ def instantiate_target(tdesc, params, connect=None, extra_platform_params=None):
platform_params = get_config_point_map(tdesc.platform_params)
conn_params = get_config_point_map(tdesc.conn_params)
assistant_params = get_config_point_map(tdesc.assistant_params)
tm_params = get_config_point_map(tdesc.tm_params)

tp, pp, cp = {}, {}, {}

Expand All @@ -75,7 +77,7 @@ def instantiate_target(tdesc, params, connect=None, extra_platform_params=None):
elif name in conn_params:
if not conn_params[name].deprecated:
cp[name] = value
elif name in assistant_params:
elif name in chain(assistant_params, tm_params):
pass
else:
msg = 'Unexpected parameter for {}: {}'
Expand Down Expand Up @@ -111,7 +113,7 @@ class TargetDescription(object):

def __init__(self, name, source, description=None, target=None, platform=None,
conn=None, assistant=None, target_params=None, platform_params=None,
conn_params=None, assistant_params=None):
conn_params=None, assistant_params=None, tm_params=None):
self.name = name
self.source = source
self.description = description
Expand All @@ -123,10 +125,12 @@ def __init__(self, name, source, description=None, target=None, platform=None,
self._set('platform_params', platform_params)
self._set('conn_params', conn_params)
self._set('assistant_params', assistant_params)
self._set('tm_params', tm_params)

def get_default_config(self):
param_attrs = ['target_params', 'platform_params',
'conn_params', 'assistant_params']
'conn_params', 'assistant_params',
'tm_params']
config = {}
for pattr in param_attrs:
for p in getattr(self, pattr):
Expand Down Expand Up @@ -610,6 +614,10 @@ class DefaultTargetDescriptor(TargetDescriptor):

def get_descriptions(self):
# pylint: disable=attribute-defined-outside-init,too-many-locals
# pylint: disable=wrong-import-position,cyclic-import
# Import here to prevent circular import
from wa.framework.target.manager import TargetManager

result = []
for target_name, target_tuple in TARGETS.items():
(target, conn, unsupported_platforms), target_params = self._get_item(target_tuple)
Expand All @@ -631,6 +639,7 @@ def get_descriptions(self):
td.target_params = target_params
td.platform_params = platform_params
td.assistant_params = assistant.parameters
td.tm_params = TargetManager.parameters

if plat_conn:
td.conn = plat_conn
Expand All @@ -652,7 +661,7 @@ def _override_params(self, params, overrides): # pylint: disable=no-self-use
for override in overrides:
if override.name in param_map:
param_map[override.name] = override
# Return the list of overriden parameters
# Return the list of overridden parameters
return list(param_map.values())

def _get_item(self, item_tuple):
Expand Down
13 changes: 11 additions & 2 deletions wa/framework/target/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ class TargetManager(object):
Specifies whether the target should be disconnected from
at the end of the run.
"""),
Parameter('cache_target_info', kind=bool, default=True,
description="""
Configure whether the cache should be used when collecting
target information.
"""),
]

def __init__(self, name, parameters, outdir):
Expand All @@ -54,6 +59,7 @@ def __init__(self, name, parameters, outdir):
self.rpm = None
self.parameters = parameters
self.disconnect = parameters.get('disconnect')
self.cache_target_info = parameters.get('cache_target_info')

def initialize(self):
self._init_target()
Expand Down Expand Up @@ -93,20 +99,23 @@ def extract_results(self, context):

@memoized
def get_target_info(self):
if not self.cache_target_info:
info = get_target_info(self.target)
return info

cache = read_target_info_cache()
info = get_target_info_from_cache(self.target.system_id, cache=cache)

if info is None:
info = get_target_info(self.target)
cache_target_info(info, cache=cache)
else:
# If module configuration has changed form when the target info
# If module configuration has changed from when the target info
# was previously cached, it is possible additional info will be
# available, so should re-generate the cache.
if module_name_set(info.modules) != module_name_set(self.target.modules):
info = get_target_info(self.target)
cache_target_info(info, overwrite=True, cache=cache)

return info

def reboot(self, context, hard=False):
Expand Down