1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-06 19:01:15 +01:00
Commit Graph

393 Commits

Author SHA1 Message Date
Sergei Trofimov
9226a3b92a fw: fix job logging indent
- Have the job manage the indent of each of its stages
- Switch output_processor to using indentcontext
- Move the "Configuring augmentations" log line into Job -- the
  rest of the stages are logged there, but this was done by the
  Executor for some reason.
2018-05-14 17:05:06 +01:00
Sergei Trofimov
98219bbba9 fw/output_processor: fix typo 2018-05-14 17:05:06 +01:00
Marc Bonnici
a61bca1a54 target/info: Fix typo 2018-05-14 16:34:10 +01:00
Sergei Trofimov
629abb1afc fw/target: add hostname to TargetInfo
Would especially be useful for Linux targets.
2018-05-10 11:51:24 +01:00
Sergei Trofimov
30eb98b275 fw/target: add hostid to TargetInfo
Add hostid entry, as reported by busybox's hostid applet, to TargetInfo.
This is intended to be a "unique 32-bit identifier for the current
machine". In practice, it may not be set, or may be generated from
something like an IP address, so may not be unique. However, if set, it
is still likely to be more unique than kernel/os version so may be worth
recording.
2018-05-10 11:51:24 +01:00
sergei Trofimov
181862b7ff fw/target: add sched_features to TargetInfo
Attempt to read scheduler features (debugfs might not be mounted) and
add them to TargetInfo.
2018-05-10 11:51:24 +01:00
sergei Trofimov
84fba8617d fw/target: enhanced cpu info
Replace Target.cpuinfo, which contained parsed contents of
/proc/cpuinfo, with a list of more comprehensive CpuInfo objects which
include cpufreq and cpuidle information as well.
2018-05-10 11:51:24 +01:00
sergei Trofimov
2d39e5699f fw/target: make TargetInfo more POD-like
Split out the loading of the TargetInfo from a target into a separate
function, leaving TargetInfo as a simple container.
2018-05-10 11:51:24 +01:00
Sergei Trofimov
1ffbce68c4 fw/execution: handle error on run initialize
- Use indentcontext inside initialize_run to make sure log level
  is dedented on error.
- Ensure Executor postamble always runs, event if runner errors.
- Fix format_duration() to handle sub-second timedeltas.
2018-05-10 11:49:30 +01:00
Sergei Trofimov
b41c3a3ea2 fw/plugin: implement __str__ for Plugin
Implement __str__ for Plugin in order to provide more readable
representations in logging.
2018-05-09 16:44:27 +01:00
Sergei Trofimov
2c28d5b214 fw/execution: implement __str__ for Executor
Implement __str__ for Executor in order to provide a more readable
representation in logs.
2018-05-09 16:44:27 +01:00
Sergei Trofimov
f477049181 fw/entrypoint: log commit hash if possible
Use get_wa_version_with_commit() instead of get_wa_version() when
logging WA version, so that the current commit is also logged, if
available.
2018-05-09 16:44:27 +01:00
Sergei Trofimov
2dbb6e8c18 fw/version: add get_wa_version_with_commit
Add a function to return WA version suffixed with the commit hash for
current HEAD. This only works if WA was deployed via

	python setup.py develop

otherwise, the output is identical to get_wa_version().
2018-05-09 16:44:27 +01:00
Sergei Trofimov
79c15ff02f fw/output: add sensible string representation
Add a useful string representation to output classes using class name and
the directory basename.
2018-05-09 16:44:27 +01:00
sergei Trofimov
a34858672f fw/plugin: do not try to load imported classes
When scanning modules for plugins, only consider classes defined in that
module, but not those imported into it. This will prevent log output
being polluted with repeated "Skipping..." messages for imported plugin
bases.
2018-05-09 15:06:31 +01:00
sergei Trofimov
ecc68ee367 utils/log: add indentcontext
Add indentcontext context manager to save having to add try/finally
clauses around indenting code just to ensure dedenting.
2018-05-09 15:06:31 +01:00
sergei Trofimov
7cf0b881c1 fw: move version and cmd line logging to main()
Move the logging of the WA version and command line used to invoke it
from run command into main() inside entrypoint. That way, these will be
the first entries in the log file, now that early log records are no
longer lost.
2018-05-09 15:06:31 +01:00
sergei Trofimov
8d330924dc fw/entrypoint: fix typos 2018-05-09 15:06:31 +01:00
sergei Trofimov
dd9a72f043 fw/config: union augmentation aliases, rather than merge
If more then one of augmentation entries ("augmentations",
"instrumenatation", "output_processors") is specified in the same
config they were being merged into a single entry.

This can cause issues with '~~' (drop everything glyph) being "resolved"
during this merge and therefore not actually used to drop all previous
augmentations.

Union'ing, instead of merging, configs at the same level avoids that.
Note that this is semantically correct, as we're not enforcing
precedence at the same level of config, so merge semantics do not apply.
2018-05-08 10:50:48 +01:00
sergei Trofimov
aacba47f9a utils/types: toggle_set: add "~~" semantics
Add support for "~~" special value that indicates that, when merging
into another set, all values from that set should in fact be dropped.
Apart from the unique merge semantics, "~~" just like any other "~"
value.
2018-05-08 10:50:48 +01:00
sergei Trofimov
5b03ac3afd config/core: JobsGenerator: delay augmentation split
Delay the split of augmentations into instruments and output processors
until they are actually being accessed; keep them as a single set until
then. This makes tracking of merges from various configurations sources
easier
2018-05-08 10:50:48 +01:00
Marc Bonnici
f4b47bf65a Fix typos 2018-04-30 09:14:11 +01:00
sergei Trofimov
f19ca4c00c fw/config: add logging to parsers
Add logging to config/agenda parsing.
2018-04-25 16:25:37 +01:00
Marc Bonnici
f463060870 framework/resource: Remove 'external_package' priority.
This priority level was left over from an older version of WA and is no
longer relevant.
2018-04-20 18:00:04 +01:00
Marc Bonnici
a963bd7768 framework/workload: Add missing alias for cleanup_assets 2018-04-20 18:00:04 +01:00
Marc Bonnici
98d9dd080c config/execution: Raise better error if no workloads specified.
If WA is ran without any workloads being specified, previously an index
error was thrown, now check that at least one global workload has been
specified and if not, provide a more helpful error message.
2018-04-11 19:05:33 +01:00
Marc Bonnici
4ab75bf722 config/core: Update decription of execution order
Remove reference to "classic" execution order.
2018-04-10 18:07:20 +01:00
Marc Bonnici
80f2e8c78b configuration/core: Fix logging rst indentation 2018-04-10 18:07:20 +01:00
Marc Bonnici
1832648add Framework/workload: Fix typo 2018-04-10 18:07:20 +01:00
Sergei Trofimov
be43d5d9b7 fw/config: add plugin_paths property to settings
Add plugin_paths property to settings which combines plugins_directory
with extra_plugin_paths, and use that inside pluginloader.
2018-04-10 10:29:44 +01:00
Sergei Trofimov
ed9dcdedd7 fw/config: add extra_plugin_paths setting
Add extra_plugin_paths setting which gets populated from WA_PLUGIN_PATHS
environment variable. This allows specifying additional locations to
scan for WA plugins.
2018-04-10 10:29:44 +01:00
Sergei Trofimov
ed74ae6654 fw/config: ensure params are obj_dict's
As part of finalizing a job spec, ensure all *_parameters are
obj_dict's.
2018-04-10 10:01:07 +01:00
Marc Bonnici
49af8ce1d3 framework/workload: Use installation timeout when pulling apk
The `install_timeout` variable is used to allow extra time when
installing an apk, if the apk is not present on the host system it
will be pulled back to the host, therefore we should allow extra time
when transferring the file in the other direction as well.
2018-04-09 16:38:09 +01:00
Marc Bonnici
65eb741f6f framework/workload: Fix Typo 2018-04-09 16:38:09 +01:00
Javi Merino
c67b917fd1 BaseUiAutomator: fix uiDeviceSwipeVertical
As it is implemented, it does the same as uiDeviceSwipeHorizontal.
Pass the x coordinates and y coordinates properly.
2018-04-06 09:48:29 +01:00
Marc Bonnici
cf4ec25615 framework/getters: Ignore connection errors with HTTP getter
If the http getter is used but a connection is not avalible, when
attempting to fetch the resource index an error will be raised. Now we
ignore the error allowing for the remaining getters to be used.
2018-04-06 09:40:05 +01:00
Sergei Trofimov
71f620f189 fw/config: add plugin type methods to plugin_cache
Add plugin type-specific methods (e.g. get_workload()) to plugin cache
so that it exposes the same interface as plugin loader.
2018-04-04 10:07:42 +01:00
setrofim
117f0f9fc4 fw/output: add augmentations to RunOutput
Add a property that gives augmentations used by all jobs in the run to
RunOutput.
2018-04-03 08:32:11 +01:00
Sergei Trofimov
d572e5210d fw/config: ensure boot/runtime_params are initialized
Ensure that boot and runtime parameters always get initialized to an
obj_dict even when not explicitly specified. This will ensure they get
serialized and deserialized properly.
2018-03-29 18:01:28 +01:00
Marc Bonnici
85d5d4f7df target/chromeosassistant: Fix missing disable_selinux parameter
Adds missing `disable_selinux` parameter to the chromeos assistant and
pass it to the android assistant if applicable.
2018-03-29 16:22:21 +01:00
Sergei Trofimov
72f2f82594 fw/config: better error when merging augs
If one or more entries for augmentations in configuration contains an
invalid value, raise ConfigError with the entry name.
2018-03-22 12:28:48 +00:00
Sergei Trofimov
3d7984412a fw/config: better message on config setting error
Catch exceptions raised when attempting to set value of a config point,
and re-raise as ConfigError with name associated with the value in the
config file.
2018-03-22 12:28:48 +00:00
Marc Bonnici
daa1959fd1 framework/workload: Refactor apk resolution
Now allows a `prefer_host_package` parameter to be set to control
whether a package located on the host system (`True`) or on the target
(`False`) should be favoured during resolution.
2018-03-20 16:17:16 +00:00
Marc Bonnici
1cb8f1670a framework/workload: Return path of pulled apk
`pull_apk` now returns the path to the apk it pulled from the device so
WA can keep track of it and avoid conflicts with other apks present
on the host.
2018-03-20 16:17:16 +00:00
Marc Bonnici
1b9205f94a wa/framework: Add support for converting WA2 configuration to WA3 style
Upon initilisation WA3 will now also check if a WA3 config file
exisits, rather than just the exsistance of the config directory.
If a `config.yaml` file is not found WA will look for a WA2 config.py
file and convert it to the new format, otherwise a default config file
will be generated.
2018-03-20 08:24:58 +00:00
Marc Bonnici
bf8c4a856a framework/workload: Add 'cleanup_assets' to global aliases
Allow specifying whether to clean up deployed assets as a global config
option as in WA2.
2018-03-20 08:24:58 +00:00
Marc Bonnici
31b46fb3b7 framework/configuration: Refactor code into seperate method 2018-03-20 08:24:58 +00:00
Sergei Trofimov
f3bb8e135a fw/execution: record UI state on error
Record UI state if an error occurs during setup, run, and output
processing stages (for other stages, the UI state is unlikely to be
relevant as they typically would not include UI manipulation).
2018-03-19 09:06:21 +00:00
Sergei Trofimov
e93199a0a0 fw/execution: add record_ui_state() to context
Add a method to record UI state (take a screen shot, and, for Android
devices, dump the UI tree structure) to ExecutionContext.
2018-03-19 09:06:21 +00:00
Sergei Trofimov
c0049d0a86 fw/job: only finalize if initialized
Only run finalize() for a job if initialize has succeed. finalize()
should be able to assume that initialize() has succeed, without needing
to check that that file have been created, variables set, etc.
2018-03-19 09:06:21 +00:00
Sergei Trofimov
f946f13838 fw/job: add workload to INFO logging
Add workload label to the INFO-level log messages produced by the job.
2018-03-16 15:38:09 +00:00
Sergei Trofimov
5b15b115a7 framework/output: add list_workloads to RunOutput
Add a convenience method to list which workloads (as per their label)
were involved in a run.
2018-03-16 15:38:09 +00:00
Sascha Bischoff
dd7ff641f3 fw/workload: Fix installed apk info
Fix an issue where AndroidWorkload.pull_apk would sometimes get the
wrong package if the desired package name is a substring of another
package name. Rather than using a regex to match the package name, use
the new get_package_info method to match the name exactly.
2018-03-15 17:06:23 +00:00
Sergei Trofimov
9689420cff fw/execution: fix Exception on abort
Hitting CTRL-C will abort execution of the current job, but will still
trigger run finalization, and possibly, post-processing and teardown of
the current job. If an exception is raised during this
post-process/teardown, the previous exception state (for the
KeybardInterrupt) will be clobbered. That means that, after the new
exception has been handled, WA would attempt to execute the next job,
rather than go to finalization of the run.

To avoid this, set a flag in the context upon catching KeybardInterrupt,
and check this flag before attempting to execute the next job in the
queue.
2018-03-08 11:18:12 +00:00
Sergei Trofimov
fda418093d fw/execution: change how error events get added
Rather than relying on a custom Logger with a context to add events when
they are logged, have the runner register hooks for corresponding
signals that do that.

The issue with the previous approach is that the event ended up
being added too late -- after the current job was already cleared, so
all events were added at run level.

With the new approach, the event will be added when it is first logged,
while there is still a current job being set. There will be no
duplication for Exceptions being re-raised and handled at different
levels because log_error() will ensure that each Exception is logged
only once.
2018-03-08 11:18:12 +00:00
Sergei Trofimov
10f79c37c2 fw/target/descriptor: add usability functions
- Add SimpleTargetDescriptor that simply returns a global list of target
  descriptions.
- Add create_target_description function to populate that list with a
  description crated from the specified components.
- Add add_description_for_target helper function to create a description
  for the specified target class, and specified components. For
  components that are not explicitly specified, attempt to guess
  sensible defaults based on the target class' bases.
2018-03-08 11:18:12 +00:00
Sergei Trofimov
9303c70727 fw/target/descriptor: fixes
- fix TargetDescription._set to set lists rather than dicts for params
  to be consistent with how params are set after creation (should
  probably get rid of this entirely...)
- fix the comment describing the structure of TARGETS
2018-03-08 11:18:12 +00:00
Sergei Trofimov
879dfc7700 framework/output: output fixes
- Get events from the result
- Correctly handle pending jobs
2018-03-08 11:18:12 +00:00
Sergei Trofimov
79aaef9986 fw/execution: abort and unresponsive target handling
Make sure KeyboardInterrupt's and unresponsive target errors are caught
and handled at appropriate points in the execution.
2018-03-08 11:18:12 +00:00
Sergei Trofimov
04ab336afc fw: fix error logging
- Keep track of logged exceptions inside log_error itself.
- signal: log the exception, if there is one  in the finally clause of
  the  signal wrapper; this will ensure that the error will be logged
  closer to the command that originated.
- entrypoint: use log.log_error for top-level error logging, rather than
  the  entrypoint logger directly; this will ensure that errors are not
  repeated unnecessarily.
- Log CTRL-C message at zeroth indent level to make it easier to see in
  the  non-verbose output where it occurred.
2018-03-08 11:18:12 +00:00
Sergei Trofimov
6fe31d6cad fw/execution: Handle unresponsive targets
If a target error occurs, check whether the target is unresponsive. If
it is, attempt to hard reset it if possible, or gracefully terminate
execution if not.
2018-03-08 11:18:12 +00:00
Sergei Trofimov
fdb872d9cd fw/target/manager: Add verify_target_responsive()
Add a method to check that the target is still responsive, and cache
the value so that the target does not need to be repeatedly probed
during various stages of wrapping up execution.
2018-03-08 11:18:12 +00:00
Sergei Trofimov
1b9ac9236a framework/exception: add ExecutionError
Add an exception class to represent an error from within the execution
framework (rather than a plugin).
2018-03-08 11:18:12 +00:00
Sergei Trofimov
d44c2ff919 framework/execution: end_run() fix part 2
Missed some "output" references in the previous commit.
2018-02-23 12:38:50 +00:00
Sergei Trofimov
0728f35cbe framwork/target: parameterize disabling of SELinux
Add a parameter to optionally not attempt to disable SELinux as that can
cause problems on some platforms.
2018-02-22 11:20:35 +00:00
Sergei Trofimov
cec3eaa375 framework/execution: fix end_run() on crash
ExecutionContext.end_run() does final updates to the run info in the run
output (final status, run duration, etc). This was previously accessed
via self.output in the context. Typically, this would correctly resolve
to the run output, as there would be no current job. However, in the
event of a crash, current_job would be set, and this would resolve to
the job output itself, resulting in run info not being updated. Use
run_output to avoid this.
2018-02-22 11:20:35 +00:00
Sergei Trofimov
12a33c8aeb framework: move instruments -> instrument
Use the singular to be consistent with other modules in wa.framework.
2018-02-22 08:41:04 +00:00
Marc Bonnici
b7aa7d68b5 config/plugin_cache: Add specific error for global and config entries
Add a special error for finding `global` or `config``  entries in
configuration to provide a more helpful error message.
2018-02-16 15:32:41 +00:00
Marc Bonnici
b103ae34ce configuration/core: Add missing initialization for classifiers 2018-02-16 14:43:52 +00:00
Sergei Trofimov
7313ed5cb5 framework/output: load job_specs
- Load job_specs from jobsfile on reload of RunOutput
- Attach the corresponding spec to a JobOutput
2018-02-16 13:56:03 +00:00
Sergei Trofimov
03328f0456 framework/output: improve access to config
Make it easier to access a run's configuration but automatically
deserializing it on reload of RunOutput, and exposing it via appropriate
settings.
2018-02-16 13:56:03 +00:00
Sergei Trofimov
8466b77d5b framework/config: fix deserialization
- RebootPolicy: correctly handle being passed another instance of
  RebootPolicy on creation; this a requirement for it to be usable as a
  ConfigurationPoint kind.
- RebootPolicy: move static method to above __init__ (consistency).
- RunConfiguration: handle deserialization of 'device_config' entry.
- RunConfiguration: move static method to above __init__ (consistency).
2018-02-16 13:56:03 +00:00
Sergei Trofimov
1e21bd2ca8 framework/output: save classifiers in Result
Save classifiers at Result as well as Metric level. Reason: when
processing output, one might want to filter complete results, as well as
individual metrics. While it is in theory possible to get the
classifiers for a job by simply extracting the common classifiers
between all metrics, this fails when there are no metrics generated for
a job (note that one might still want to process the output in this
case, e.g. for the artifacts).
2018-02-16 13:56:03 +00:00
Marc Bonnici
4b6297e7ea configuration/plugin_cache: Fix incorrect parmeter name 2018-02-15 13:42:48 +00:00
Marc Bonnici
ed75764445 configuration/plugin_cache: Add target names as allowed plugin configs
Allow setting of device configuration by specifying target name.
2018-02-15 13:42:48 +00:00
Marc Bonnici
52dca17fef target/descriptor: Fix generate target default config
Was previously expecting a dictionary of parameter attributes however the
actual type is a list.
2018-02-15 13:42:48 +00:00
Marc Bonnici
4703dc616a framework/agenda: Remove unused code 2018-02-14 17:03:21 +00:00
Marc Bonnici
ad5fd0076c configuration/core: Add missing parameter alias for workload_parmeters 2018-02-14 17:03:21 +00:00
Sergei Trofimov
b1b379982c framework/output: fix job status
After loading (or attempting to load) job output, update the status from
the state, as that will be more accurate.
2018-02-14 11:13:05 +00:00
Sergei Trofimov
c87d016025 framework/output: handle missing/corrupt result files.
Do not explode if a result file for a job is missing when loading a
RunOutput. Specify job status as "UNKNOWN" and add the exception from
attempting to load the file to the events.
2018-02-14 11:13:05 +00:00
Marc Bonnici
0543982f29 framework/host: Generate default config.yaml upon first init 2018-02-14 09:13:04 +00:00
Marc Bonnici
dfce5ca7ba configuration/default: Update to use augmentation terminology 2018-02-14 09:13:04 +00:00
Marc Bonnici
73416d40c2 configuration/core: Remove unused RTParam code 2018-02-14 09:13:04 +00:00
Marc Bonnici
1ec1bd14a5 configuration/core: Remove unnecessary config point
`Augmentations` configuration point should be used instead of `output_processors`
entry which is already specified elsewhere.
2018-02-14 09:13:04 +00:00
Marc Bonnici
965f8e2218 configuration/core: Make generic_android default device 2018-02-14 09:13:04 +00:00
Marc Bonnici
d7f28da71e configuration/core: Add missing description to doc string 2018-02-14 09:13:04 +00:00
Sergei Trofimov
b33defbfea framework/workload: fix "no matching package" error
Fix an issue introduced by commit 42fb3eb

	framework/workload: make "no matching package" message more useful

PackageHandler was incorrectly passing self.name into the error message
instead of self.owner.name.
2018-02-12 11:45:03 +00:00
Sergei Trofimov
42fb3eb148 framework/workload: make "no matching package" message more useful
Make the error message reported when no matching Android app package
could be found more useful by including the workload name, and, if
applicable, sought version.
2018-02-09 17:45:04 +00:00
Marc Bonnici
22a2ccf7d6 target/logcatpoller: Make capitalisation consistent 2018-02-07 10:01:12 +00:00
Marc Bonnici
728057dbba target/androidassistant: Fix Logcat poller creation
Threads cannot be restarted therfore we need to create a new polling
thread for each time the poller is started.
2018-02-07 10:01:12 +00:00
Marc Bonnici
07cd770288 framework/plugin_cache: Fix missing assistant parameters 2018-02-07 10:01:12 +00:00
Marc Bonnici
36309a4cf2 target/assistant: Fix logcat poller
Rename the `start` method to `run` as this is what is what is called
by the threading module's `start` method, otherwise this causes the
polling to be done in the main thread blocking execution.
2018-02-07 10:01:12 +00:00
Sergei Trofimov
c5df74eb56 framework/config: load plugins from extra packages
Add support for loading plugins from packages that register themselves
with WA by writing their names into $WA_USER_DIRECTORY/packages.

This is functionality that existed in WA2 and was omitted in WA3 until
now.
2018-02-06 17:30:49 +00:00
Sergei Trofimov
58c4ae609c framework/output_processor: fix get_output_processor()
Output processor names are converted to identifiers when they are
loaded. Ensure the same thing happens when looking up installed output
processors with get_output_processor().
2018-02-06 09:49:58 +00:00
Marc Bonnici
9a556721b6 Augmentations: Allow configuring of augmentations per workload
Add support for enabling and disabling of augmentations (instruments and
output processors) on a per workload basis.
2018-02-01 14:26:08 +00:00
Marc Bonnici
557d62ce86 framework/configuration: Fix disabling of augmentations
Previously disabling of augmentaions via using the `--disable`
flag or by using the "~" notation in agendas was ignored.
2018-02-01 14:26:08 +00:00
Sergei Trofimov
dae4d9a934 framework/execution: add context to job signals
Pass the execution context to job execution signal callbacks.
2018-01-25 10:50:02 +00:00
Sergei Trofimov
a2c113e0f9 framework/signal: log on connect/disconnect
Add debug level logging for connect() and disconnect() functions.
2018-01-25 10:50:02 +00:00
Sergei Trofimov
fc56de8842 framework/instruments: add ManagedCallback __repr__
Add a __repr__ for ManagedCallback callback to prove a useful
representation in logging.
2018-01-25 10:50:02 +00:00
Marc Bonnici
1101c358d0 framework/rt_config: Add support for chromeos for some AndroidRTConfig
Allows setting of select android runtime configuration for devices running
chromeos and which support android. Currently only 'brightness' is functioning
correctly therefore the other parameters are only enable for standard android devices.
2018-01-25 06:32:37 +00:00