Skip to content

Commit

Permalink
feat: turn enumwrappers into real python enumerators
Browse files Browse the repository at this point in the history
  • Loading branch information
qdelamea-aneo committed Nov 18, 2024
1 parent 3e97b32 commit 7d76424
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions packages/python/src/armonik/common/enumwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class TaskStatus(IntEnum):
PAUSED = TASK_STATUS_PAUSED


class EventTypes:
class EventTypes(IntEnum):
UNSPECIFIED = EVENTS_ENUM_UNSPECIFIED
NEW_TASK = EVENTS_ENUM_NEW_TASK
TASK_STATUS_UPDATE = EVENTS_ENUM_TASK_STATUS_UPDATE
Expand All @@ -88,11 +88,7 @@ def from_string(cls, name: str):
return getattr(cls, name.upper())


class SessionStatus:
@staticmethod
def name_from_value(status: RawSessionStatus) -> str:
return _SESSIONSTATUS.values_by_number[status].name

class SessionStatus(IntEnum):
UNSPECIFIED = SESSION_STATUS_UNSPECIFIED
RUNNING = SESSION_STATUS_RUNNING
CANCELLED = SESSION_STATUS_CANCELLED
Expand All @@ -102,11 +98,7 @@ def name_from_value(status: RawSessionStatus) -> str:
DELETED = SESSION_STATUS_DELETED


class ResultStatus:
@staticmethod
def name_from_value(status: RawResultStatus) -> str:
return _RESULTSTATUS.values_by_number[status].name

class ResultStatus(IntEnum):
UNSPECIFIED = RESULT_STATUS_UNSPECIFIED
CREATED = RESULT_STATUS_CREATED
COMPLETED = RESULT_STATUS_COMPLETED
Expand All @@ -115,19 +107,19 @@ def name_from_value(status: RawResultStatus) -> str:
NOTFOUND = RESULT_STATUS_NOTFOUND


class ServiceHealthCheckStatus:
class ServiceHealthCheckStatus(IntEnum):
UNSPECIFIED = HEALTH_STATUS_ENUM_UNSPECIFIED
HEALTHY = HEALTH_STATUS_ENUM_HEALTHY
DEGRADED = HEALTH_STATUS_ENUM_DEGRADED
UNHEALTHY = HEALTH_STATUS_ENUM_UNHEALTHY


class HealthCheckStatus:
class HealthCheckStatus(IntEnum):
UNKNOWN = HealthCheckReply.UNKNOWN
SERVING = HealthCheckReply.SERVING
NOT_SERVING = HealthCheckReply.NOT_SERVING


class Direction:
class Direction(IntEnum):
ASC = SORT_DIRECTION_ASC
DESC = SORT_DIRECTION_DESC

0 comments on commit 7d76424

Please sign in to comment.