Skip to content

Commit 8199182

Browse files
committed
cmg: Use helper for getting CMS URL
Use the previously added helper for constructing the CMS URL, allowing the use of a proxy between the gateway and the CMS instances. Disable SSL verification for the requests to the CMS instances until a valid certificate is added. Signed-off-by: Phoevos Kalemkeris <[email protected]>
1 parent 62cda27 commit 8199182

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

cogstack_model_gateway/gateway/routers/models.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from cogstack_model_gateway.gateway.core.models import get_running_models, run_model_container
1616
from cogstack_model_gateway.gateway.core.priority import calculate_task_priority
1717
from cogstack_model_gateway.gateway.routers.utils import (
18+
get_cms_url,
1819
get_content_type,
1920
get_query_params,
2021
validate_model_name,
@@ -122,7 +123,8 @@ async def get_models(
122123
@router.get("/models/{model_name}/info", response_model=dict, tags=["models"])
123124
async def get_model_info(model_name: str):
124125
"""Get information about a running model server through its `/info` API."""
125-
response = requests.get(f"http://{model_name}:8000/info")
126+
# FIXME: Enable SSL verification when certificates are properly set up
127+
response = requests.get(get_cms_url(model_name, "info"), verify=False)
126128
if response.status_code == 404:
127129
raise HTTPException(
128130
status_code=404,
@@ -295,7 +297,7 @@ async def execute_task(
295297
task = {
296298
"uuid": task_uuid,
297299
"method": endpoint["method"],
298-
"url": f"http://{model_name}:8000{endpoint['url']}",
300+
"url": get_cms_url(model_name, endpoint["url"]),
299301
"content_type": content_type,
300302
"params": query_params,
301303
"refs": references,

cogstack_model_gateway/scheduler/scheduler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@ def route_task(self, task: dict) -> tuple[Response, str]:
5353
response = None
5454
try:
5555
log.debug(f"Request: {req}")
56+
# FIXME: Enable SSL verification when certificates are properly set up
5657
response = request(
5758
method=req["method"],
5859
url=req["url"],
5960
headers=req["headers"],
6061
params=req["params"],
6162
data=req["data"],
6263
files=req["files"],
64+
verify=False,
6365
)
6466
log.debug(f"Response: {response.text}")
6567
response.raise_for_status()

0 commit comments

Comments
 (0)