1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-02 03:12:34 +01:00

utils/types: better enum class member setting

- What used to be enum.values is now enum.levels.
- Add enum.names and enum.values that are lists of enum's levels' names
  and values respectively.
- Add a check on creation to make sure that provided level names do not
  conflict with the atomatically created members.
This commit is contained in:
Sergei Trofimov
2017-08-09 15:24:57 +01:00
parent 8d27b50a7c
commit a9959550af
4 changed files with 24 additions and 8 deletions

View File

@@ -741,7 +741,7 @@ class RunConfiguration(Configuration):
'retry_on_status',
kind=list_of(Status),
default=['FAILED', 'PARTIAL'],
allowed_values=Status.values[Status.RUNNING.value:],
allowed_values=Status.levels[Status.RUNNING.value:],
description='''
This is list of statuses on which a job will be considered to have
failed and will be automatically retried up to ``max_retries``

View File

@@ -186,7 +186,7 @@ def priority(priority):
def wrapper(*args, **kwargs):
return func(*args, **kwargs)
wrapper.func_name = func.func_name
if priority in Priority.values:
if priority in Priority.levels:
wrapper.priority = Priority(priority)
else:
if not isinstance(priority, int):