From dd73a2fff0fda25ec461fec7e483fc5e087e197a Mon Sep 17 00:00:00 2001 From: Filippo Ledda Date: Tue, 8 Oct 2024 18:55:03 +0200 Subject: [PATCH] CH-110 fix quotas assignment --- .../src/harness_jupyter/harness_jupyter/jupyterhub.py | 6 +++--- libraries/cloudharness-common/cloudharness/auth/quota.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/applications/jupyterhub/src/harness_jupyter/harness_jupyter/jupyterhub.py b/applications/jupyterhub/src/harness_jupyter/harness_jupyter/jupyterhub.py index 3c9679e3..d2814ed4 100644 --- a/applications/jupyterhub/src/harness_jupyter/harness_jupyter/jupyterhub.py +++ b/applications/jupyterhub/src/harness_jupyter/harness_jupyter/jupyterhub.py @@ -225,10 +225,10 @@ def change_pod_manifest(self: KubeSpawner): # set user quota cpu/mem usage if value has a "value" else don't change the value logging.info("Setting user quota cpu/mem usage") - set_key_value(self, key="cpu_guarantee", value=user_quotas.get( - "quota-ws-guaranteecpu")) + set_key_value(self, key="cpu_guarantee", value=float(user_quotas.get( + "quota-ws-guaranteecpu"))) set_key_value(self, key="cpu_limit", - value=user_quotas.get("quota-ws-maxcpu")) + value=float(user_quotas.get("quota-ws-maxcpu"))) set_key_value(self, key="mem_guarantee", value=user_quotas.get( "quota-ws-guaranteemem"), unit="G") set_key_value(self, key="mem_limit", value=user_quotas.get( diff --git a/libraries/cloudharness-common/cloudharness/auth/quota.py b/libraries/cloudharness-common/cloudharness/auth/quota.py index cbe428ad..eb06d5a4 100644 --- a/libraries/cloudharness-common/cloudharness/auth/quota.py +++ b/libraries/cloudharness-common/cloudharness/auth/quota.py @@ -39,7 +39,7 @@ def get_user_quotas(application_config: ApplicationConfig = None, user_id: str = valid_keys_map = {key for key in base_quotas} try: - return get_user_attributes(user_id, valid_keys=valid_keys_map, default_attributes=base_quotas) + return get_user_attributes(user_id, valid_keys=valid_keys_map, default_attributes=base_quotas, transform_value_fn=attribute_to_quota) except UserNotFound as e: log.warning("Quotas not available: error retrieving user: %s", user_id)