mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-06-20 15:26:00 +01:00
Initial commit of open source Workload Automation.
This commit is contained in:
.gitignoreLICENSEMANIFEST.inREADME.rst
dev_scripts
doc
Makefilebuild_extension_docs.pybuild_instrumentation_method_map.py
source
_static
_templates
additional_topics.rstagenda.rstchanges.rstconf.pyconfiguration.rstcontributing.rstconventions.rstdaq_device_setup.rstdevice_setup.rstexecution_model.rstindex.rstinstallation.rstinstrumentation_method_map.rstinstrumentation_method_map.templateinvocation.rstquickstart.rstresources.rstrevent.rstwa-execution.pngwriting_extensions.rstextras
scripts
setup.pywlauto
__init__.pyagenda-example-biglittle.yamlagenda-example-tutorial.yaml
commands
common
config_example.pycore
__init__.pyagenda.pybootstrap.pycommand.pyconfiguration.pydevice.pyentry_point.pyexecution.pyextension.pyextension_loader.pyexttype.pyinstrumentation.pyresolver.pyresource.pyresult.pysignal.pyversion.pyworkload.py
devices
exceptions.pyexternal
README
bbench_server
daq_server
louie
LICENSE__init__.pydispatcher.pyerror.pyplugin.pyprioritylist.pyrobustapply.pysaferef.pysender.pysignal.py
test
__init__.pyconftest.pyfixture.pytest_dispatcher.pytest_plugin.pytest_prioritydispatcher.pytest_prioritylist.pytest_robustapply.pytest_saferef.py
version.pypmu_logger
readenergy
revent
terminalsize.pyuiauto
instrumentation
__init__.py
coreutil
daq
delay
dmesg
energy_probe
fps
hwmon
juno_energy
misc
perf
pmu_logger
streamline
trace_cmd
modules
resource_getters
result_processors
tests
README__init__.py
data
test_agenda.pytest_config.pytest_device.pytest_diff.pytest_execution.pytest_extension.pytest_extension_loader.pytest_instrumentation.pytest_results_manager.pytest_utils.pytools
utils
__init__.pyandroid.pycli.pycpuinfo.pydoc.pyformatter.pyhwmon.pylog.pymisc.pynetio.pyserial_port.pyssh.pytypes.pyuefi.py
workloads
__init__.py
andebench
angrybirds
angrybirds_rio
anomaly2
antutu
applaunch
audio
bbench
benchmarkpi
caffeinemark
cameracapture
camerarecord
castlebuilder
castlemaster
cfbench
citadel
cyclictest
dex2oat
dhrystone
dungeondefenders
facebook
geekbench
glbcorp
glbenchmark
gunbros2
homescreen
idle
ironman
krazykart
linpack
manual
memcpy
nenamark
peacekeeper
quadrant
real_linpack
realracing3
shellscript
skypevideo
smartbench
spec2000
sqlite
sysbench
templerun
thechase
truckerparking3d
vellamo
video
videostreaming
143
wlauto/exceptions.py
Normal file
143
wlauto/exceptions.py
Normal file
@ -0,0 +1,143 @@
|
||||
# Copyright 2013-2015 ARM Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
|
||||
from wlauto.utils.misc import get_traceback, TimeoutError # NOQA pylint: disable=W0611
|
||||
|
||||
|
||||
class WAError(Exception):
|
||||
"""Base class for all Workload Automation exceptions."""
|
||||
pass
|
||||
|
||||
|
||||
class NotFoundError(WAError):
|
||||
"""Raised when the specified item is not found."""
|
||||
pass
|
||||
|
||||
|
||||
class ValidationError(WAError):
|
||||
"""Raised on failure to validate an extension."""
|
||||
pass
|
||||
|
||||
|
||||
class DeviceError(WAError):
|
||||
"""General Device error."""
|
||||
pass
|
||||
|
||||
|
||||
class DeviceNotRespondingError(WAError):
|
||||
"""The device is not responding."""
|
||||
|
||||
def __init__(self, device):
|
||||
super(DeviceNotRespondingError, self).__init__('Device {} is not responding.'.format(device))
|
||||
|
||||
|
||||
class WorkloadError(WAError):
|
||||
"""General Workload error."""
|
||||
pass
|
||||
|
||||
|
||||
class HostError(WAError):
|
||||
"""Problem with the host on which WA is running."""
|
||||
pass
|
||||
|
||||
|
||||
class ModuleError(WAError):
|
||||
"""
|
||||
Problem with a module.
|
||||
|
||||
.. note:: Modules for specific extension types should raise execeptions
|
||||
appropriate to that extension. E.g. a ``Device`` module should raise
|
||||
``DeviceError``. This is intended for situation where a module is
|
||||
unsure (and/or doesn't care) what its owner is.
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class InstrumentError(WAError):
|
||||
"""General Instrument error."""
|
||||
pass
|
||||
|
||||
|
||||
class ResultProcessorError(WAError):
|
||||
"""General ResultProcessor error."""
|
||||
pass
|
||||
|
||||
|
||||
class ResourceError(WAError):
|
||||
"""General Resolver error."""
|
||||
pass
|
||||
|
||||
|
||||
class CommandError(WAError):
|
||||
"""Raised by commands when they have encountered an error condition
|
||||
during execution."""
|
||||
pass
|
||||
|
||||
|
||||
class ToolError(WAError):
|
||||
"""Raised by tools when they have encountered an error condition
|
||||
during execution."""
|
||||
pass
|
||||
|
||||
|
||||
class LoaderError(WAError):
|
||||
"""Raised when there is an error loading an extension or
|
||||
an external resource. Apart form the usual message, the __init__
|
||||
takes an exc_info parameter which should be the result of
|
||||
sys.exc_info() for the original exception (if any) that
|
||||
caused the error."""
|
||||
|
||||
def __init__(self, message, exc_info=None):
|
||||
super(LoaderError, self).__init__(message)
|
||||
self.exc_info = exc_info
|
||||
|
||||
def __str__(self):
|
||||
if self.exc_info:
|
||||
orig = self.exc_info[1]
|
||||
orig_name = type(orig).__name__
|
||||
if isinstance(orig, WAError):
|
||||
reason = 'because of:\n{}: {}'.format(orig_name, orig)
|
||||
else:
|
||||
reason = 'because of:\n{}\n{}: {}'.format(get_traceback(self.exc_info), orig_name, orig)
|
||||
return '\n'.join([self.message, reason])
|
||||
else:
|
||||
return self.message
|
||||
|
||||
|
||||
class ConfigError(WAError):
|
||||
"""Raised when configuration provided is invalid. This error suggests that
|
||||
the user should modify their config and try again."""
|
||||
pass
|
||||
|
||||
|
||||
class WorkerThreadError(WAError):
|
||||
"""
|
||||
This should get raised in the main thread if a non-WAError-derived exception occurs on
|
||||
a worker/background thread. If a WAError-derived exception is raised in the worker, then
|
||||
it that exception should be re-raised on the main thread directly -- the main point of this is
|
||||
to preserve the backtrace in the output, and backtrace doesn't get output for WAErrors.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, thread, exc_info):
|
||||
self.thread = thread
|
||||
self.exc_info = exc_info
|
||||
orig = self.exc_info[1]
|
||||
orig_name = type(orig).__name__
|
||||
message = 'Exception of type {} occured on thread {}:\n'.format(orig_name, thread)
|
||||
message += '{}\n{}: {}'.format(get_traceback(self.exc_info), orig_name, orig)
|
||||
super(WorkerThreadError, self).__init__(message)
|
Reference in New Issue
Block a user