Skip to content

Commit

Permalink
feat: turn enumwrappers into real python enumerators (#570)
Browse files Browse the repository at this point in the history
  • Loading branch information
qdelamea-aneo authored Nov 21, 2024
2 parents 90f0b51 + 12a884e commit 334b694
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 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,7 +88,7 @@ def from_string(cls, name: str):
return getattr(cls, name.upper())


class SessionStatus:
class SessionStatus(IntEnum):
@staticmethod
def name_from_value(status: RawSessionStatus) -> str:
return _SESSIONSTATUS.values_by_number[status].name
Expand All @@ -102,7 +102,7 @@ def name_from_value(status: RawSessionStatus) -> str:
DELETED = SESSION_STATUS_DELETED


class ResultStatus:
class ResultStatus(IntEnum):
@staticmethod
def name_from_value(status: RawResultStatus) -> str:
return _RESULTSTATUS.values_by_number[status].name
Expand All @@ -115,19 +115,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
2 changes: 1 addition & 1 deletion packages/python/src/armonik/common/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def from_message(cls, task_options):
application_namespace=task_options.application_namespace,
application_service=task_options.application_service,
engine_type=task_options.engine_type,
options=task_options.options,
options={k: v for k, v in task_options.options.items()},
)

def to_message(self) -> RawTaskOptions:
Expand Down

0 comments on commit 334b694

Please sign in to comment.