From dda2ff362e636ac0741722bd61d89bfeb2cfbccb Mon Sep 17 00:00:00 2001 From: Ignacio Heredia Date: Mon, 23 Sep 2024 11:57:55 +0200 Subject: [PATCH] fix: better catch missing tryme resources --- ai4papi/routers/v1/try_me/nomad.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ai4papi/routers/v1/try_me/nomad.py b/ai4papi/routers/v1/try_me/nomad.py index ef560fb..9e33190 100644 --- a/ai4papi/routers/v1/try_me/nomad.py +++ b/ai4papi/routers/v1/try_me/nomad.py @@ -77,7 +77,7 @@ def create_deployment( for k in keys: status[k] += node[k] for r in resources: - if status[f"{r}_used"] / status[f"{r}_total"] > 0.95: + if status[f"{r}_total"] == 0 or status[f"{r}_used"] / status[f"{r}_total"] > 0.95: raise HTTPException( status_code=503, detail="Sorry, but there seem to be no resources available right " \