From 8a5fc275a3f7389d52e7bca5481327f792cfcfff Mon Sep 17 00:00:00 2001 From: octodog Date: Thu, 4 Jul 2024 14:03:55 +0900 Subject: [PATCH] fix: mismatches between runtime listing and service creation API (#2371) (#2375) Co-authored-by: Kyujin Cho Backported-from: main (24.09) Backported-to: 24.03 Backport-of: 2371 --- changes/2371.fix.md | 1 + src/ai/backend/manager/api/service.py | 2 +- src/ai/backend/manager/models/endpoint.py | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 changes/2371.fix.md diff --git a/changes/2371.fix.md b/changes/2371.fix.md new file mode 100644 index 0000000000..03b5d051f5 --- /dev/null +++ b/changes/2371.fix.md @@ -0,0 +1 @@ +Fix mismatches between responses of `/services/_runtimes` and new model service creation input diff --git a/src/ai/backend/manager/api/service.py b/src/ai/backend/manager/api/service.py index 7a78482471..1455f4c2fc 100644 --- a/src/ai/backend/manager/api/service.py +++ b/src/ai/backend/manager/api/service.py @@ -1195,7 +1195,7 @@ class RuntimeInfoModel(BaseModel): async def list_supported_runtimes(request: web.Request) -> RuntimeInfoModel: return RuntimeInfoModel( runtimes=[ - RuntimeInfo(name=v.name, human_readable_name=MODEL_SERVICE_RUNTIME_PROFILES[v].name) + RuntimeInfo(name=v.value, human_readable_name=MODEL_SERVICE_RUNTIME_PROFILES[v].name) for v in RuntimeVariant ] ) diff --git a/src/ai/backend/manager/models/endpoint.py b/src/ai/backend/manager/models/endpoint.py index c466b17bff..061b7d9806 100644 --- a/src/ai/backend/manager/models/endpoint.py +++ b/src/ai/backend/manager/models/endpoint.py @@ -702,7 +702,7 @@ class RuntimeVariantInfo(graphene.ObjectType): @classmethod def from_enum(cls, enum: RuntimeVariant) -> "RuntimeVariantInfo": - return cls(name=enum.name, human_readable_name=MODEL_SERVICE_RUNTIME_PROFILES[enum].name) + return cls(name=enum.value, human_readable_name=MODEL_SERVICE_RUNTIME_PROFILES[enum].name) class Endpoint(graphene.ObjectType): @@ -1107,7 +1107,7 @@ async def _do_mutate() -> ModifyEndpoint: if (_newval := props.runtime_variant) and _newval is not Undefined: try: - endpoint_row.runtime_variant = RuntimeVariant[_newval] + endpoint_row.runtime_variant = RuntimeVariant(_newval) except KeyError: raise InvalidAPIParameters(f"Unsupported runtime {_newval}")