mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-09-01 19:02:31 +01:00
Handle retry failed
This commit is contained in:
@@ -22,6 +22,8 @@ import subprocess
|
||||
|
||||
import colorama
|
||||
|
||||
from devlib import DevlibError
|
||||
|
||||
from wa.framework import signal
|
||||
from wa.framework.exception import WAError
|
||||
from wa.utils.misc import get_traceback
|
||||
@@ -142,7 +144,7 @@ def log_error(e, logger, critical=False):
|
||||
|
||||
if isinstance(e, KeyboardInterrupt):
|
||||
log_func('Got CTRL-C. Aborting.')
|
||||
elif isinstance(e, WAError):
|
||||
elif isinstance(e, WAError) or isinstance(e, DevlibError):
|
||||
log_func(e)
|
||||
elif isinstance(e, subprocess.CalledProcessError):
|
||||
tb = get_traceback()
|
||||
|
@@ -504,12 +504,16 @@ class level(object):
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, level):
|
||||
return self.value == other.value
|
||||
elif isinstance(other, basestring):
|
||||
return self.name == other
|
||||
else:
|
||||
return self.value == other
|
||||
|
||||
def __ne__(self, other):
|
||||
if isinstance(other, level):
|
||||
return self.value != other.value
|
||||
elif isinstance(other, basestring):
|
||||
return self.name != other
|
||||
else:
|
||||
return self.value != other
|
||||
|
||||
@@ -524,21 +528,39 @@ def enum(args, start=0):
|
||||
::
|
||||
MyEnum = enum(['A', 'B', 'C'])
|
||||
|
||||
is equivalent of::
|
||||
is roughly equivalent of::
|
||||
|
||||
class MyEnum(object):
|
||||
A = 0
|
||||
B = 1
|
||||
C = 2
|
||||
|
||||
however it also implement some specialized behaviors for comparisons and
|
||||
instantiation.
|
||||
|
||||
"""
|
||||
|
||||
class Enum(object):
|
||||
pass
|
||||
|
||||
def __new__(cls, name):
|
||||
for attr_name in dir(cls):
|
||||
if attr_name.startswith('__'):
|
||||
continue
|
||||
|
||||
attr = getattr(cls, attr_name)
|
||||
if name == attr:
|
||||
return attr
|
||||
|
||||
raise ValueError('Invalid enum value: {}'.format(repr(name)))
|
||||
|
||||
levels = []
|
||||
for i, v in enumerate(args, start):
|
||||
name = string.upper(identifier(v))
|
||||
setattr(Enum, name, level(v, i))
|
||||
lv = level(v, i)
|
||||
setattr(Enum, name, lv)
|
||||
levels.append(lv)
|
||||
|
||||
setattr(Enum, 'values', levels)
|
||||
|
||||
return Enum
|
||||
|
||||
|
Reference in New Issue
Block a user