From 5e95e398229642b39dde3ddd5bcb4e0db5e37c00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= Date: Fri, 14 Jan 2022 18:49:13 +0100 Subject: [PATCH] [UPSTREAM] Make sure size is properly loaded from user CM --- .jupyter/jupyterhub_config.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.jupyter/jupyterhub_config.py b/.jupyter/jupyterhub_config.py index 82e04b0..bd9ae99 100644 --- a/.jupyter/jupyterhub_config.py +++ b/.jupyter/jupyterhub_config.py @@ -241,12 +241,14 @@ async def get_url(self): return url - def get_image(self): - image = self.single_user_profiles.user.get(self.user.name)['last_selected_image'] +def set_from_profile(self): + profile = self.single_user_profiles.user.get(self.user.name) + image = profile['last_selected_image'] if custom_notebook_namespace: - return f'image-registry.openshift-image-registry.svc:5000/{namespace}/%s' % image - else: - return image + image = f'image-registry.openshift-image-registry.svc:5000/{namespace}/%s' % image + + self.image = image + self.deployment_size = profile['last_selected_size'] def apply_pod_profile(spawner, pod): @@ -256,7 +258,7 @@ def apply_pod_profile(spawner, pod): return SingleuserProfiles.apply_pod_profile(spawner.user.name, pod, profile, gpu_types, DEFAULT_MOUNT_PATH, spawner.gpu_mode) def setup_environment(spawner): - spawner.image = spawner.get_image() + spawner.set_from_profile() spawner.single_user_profiles.load_profiles(username=spawner.user.name) spawner.single_user_profiles.setup_services(spawner, spawner.image, spawner.user.name)