Skip to content

Commit 9b464e9

Browse files
committed
Instrumented create_new_radix_job()
1 parent 37fe9ad commit 9b464e9

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

backend/src/backend/primary/routers/dev_radix_helpers.py

+12-5
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,25 @@ async def create_new_radix_job(job_component_name: str, job_scheduler_port: int)
6161
}
6262

6363
async with httpx.AsyncClient() as client:
64-
response = await client.post(url=url, json=request_body)
65-
response.raise_for_status()
64+
try:
65+
response = await client.post(url=url, json=request_body)
66+
response.raise_for_status()
67+
except httpx.RequestError as exc:
68+
LOGGER.error(f"An error occurred while requesting POST {exc.request.url!r}.")
69+
return None
70+
except httpx.HTTPStatusError as exc:
71+
LOGGER.error(f"Error HTTP status {exc.response.status_code} while requesting POST {exc.request.url!r}.")
72+
return None
6673

6774
# According to doc it seems we should be getting a json back that contains a status field,
6875
# which should be "Running" if the job was started successfully.
6976
# Apparently this is not the case, as of Feb 2024, the only useful piece of information we're getting
7077
# back from this call is the name of the newly created job.
7178
response_dict = response.json()
7279

73-
# LOGGER.debug("------")
74-
# LOGGER.debug(f"{response_dict=}")
75-
# LOGGER.debug("------")
80+
LOGGER.debug("------")
81+
LOGGER.debug(f"{response_dict=}")
82+
LOGGER.debug("------")
7683

7784
radix_job_name = response_dict["name"]
7885
return radix_job_name

0 commit comments

Comments
 (0)