Skip to content

Commit 74a63de

Browse files
committed
Fix user quota set
1 parent ddb543d commit 74a63de

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

  • applications/jupyterhub/src/harness_jupyter/harness_jupyter

applications/jupyterhub/src/harness_jupyter/harness_jupyter/jupyterhub.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def affinity_spec(key, value):
7373
'topologyKey': 'kubernetes.io/hostname'
7474
}
7575

76+
7677
def affinity_preferred_spec(key, value, topology_key='kubernetes.io/hostname', operator='In'):
7778
"""
7879
Generates a Kubernetes preferred affinity term.
@@ -194,14 +195,10 @@ def change_pod_manifest(self: KubeSpawner):
194195

195196
logging.info("Setting user quota cpu/mem usage")
196197

197-
if self.cpu_guarantee is None: # This eventually comes from the current profile. Profile wins over user quota, if set.
198-
set_key_value(self, key="cpu_guarantee", value=float(user_quotas.get("quota-ws-guaranteecpu")))
199-
if self.cpu_limit is None:
200-
set_key_value(self, key="cpu_limit", value=float(user_quotas.get("quota-ws-maxcpu")))
201-
if self.mem_guarantee is None:
202-
set_key_value(self, key="mem_guarantee", value=user_quotas.get("quota-ws-guaranteemem"), unit="G")
203-
if self.mem_limit is None:
204-
set_key_value(self, key="mem_limit", value=user_quotas.get("quota-ws-maxmem"), unit="G")
198+
set_key_value(self, key="cpu_guarantee", value=float(user_quotas.get("quota-ws-guaranteecpu", self.cpu_guarantee)))
199+
set_key_value(self, key="cpu_limit", value=float(user_quotas.get("quota-ws-maxcpu", self.cpu_limit)))
200+
set_key_value(self, key="mem_guarantee", value=user_quotas.get("quota-ws-guaranteemem", self.mem_guarantee), unit="G")
201+
set_key_value(self, key="mem_limit", value=user_quotas.get("quota-ws-maxmem", self.mem_limit), unit="G")
205202

206203
# Default value, might be overwritten by the app config
207204
self.storage_pvc_ensure = bool(self.pvc_name)

0 commit comments

Comments
 (0)