Skip to content

Commit

Permalink
fix: fix MinIO info
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnacioHeredia committed Dec 12, 2024
1 parent ba6e0fc commit 02646c4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ai4papi/routers/v1/inference/oscar.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class Service(BaseModel):
image: str
cpu: NonNegativeInt = 2
memory: NonNegativeInt = 3000
memory: NonNegativeInt = 30000
allowed_users: List[str] = [] # no additional users by default
title: str = ""

Expand Down Expand Up @@ -185,6 +185,9 @@ def get_services_list(
client = get_client_from_auth(authorization.credentials, vo)
r = client.list_services()

# Retrieve cluster config for MinIO info
client_conf = client.get_cluster_config().json()

# Filter services
services = []
for s in json.loads(r.text):
Expand All @@ -200,10 +203,14 @@ def get_services_list(
if vo not in s.get("vo", []):
continue

# Add service endpoint
# Add service endpoint for sync calls
cluster_endpoint = MAIN_CONF["oscar"]["clusters"][vo]["endpoint"]
s["endpoint"] = f"{cluster_endpoint}/run/{s['name']}"

# Info for async calls
# Replace MinIO info with the one retrieved from client (which is the correct one)
s["storage_providers"]["minio"]["default"] = client_conf["minio_provider"]

services.append(s)

# Sort services by creation time, recent to old
Expand Down

0 comments on commit 02646c4

Please sign in to comment.