From 1bdb75a5d2d2a6493e2fc684c29a928b37769547 Mon Sep 17 00:00:00 2001 From: Zoran Sinnema Date: Tue, 6 Dec 2022 15:12:16 +0100 Subject: [PATCH] #645 feat: jupyterhub skip profile list form for now --- .../harness_jupyter/jupyterhub.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/applications/jupyterhub/src/harness_jupyter/harness_jupyter/jupyterhub.py b/applications/jupyterhub/src/harness_jupyter/harness_jupyter/jupyterhub.py index 4bf07c33..48e6be3d 100755 --- a/applications/jupyterhub/src/harness_jupyter/harness_jupyter/jupyterhub.py +++ b/applications/jupyterhub/src/harness_jupyter/harness_jupyter/jupyterhub.py @@ -11,10 +11,23 @@ handler.setLevel(logging.DEBUG) logging.getLogger().addHandler(handler) + +def custom_options_form(spawner, abc): + # let's skip the profile selection form for now + # ToDo: for future we can remove this hook + spawner.profile_list = [] + # ref: https://github.com/jupyterhub/kubespawner/blob/37a80abb0a6c826e5c118a068fa1cf2725738038/kubespawner/spawner.py#L1885-L1935 + return spawner._options_form_default() + + def harness_hub(): """Wraps the method to change spawner configuration""" KubeSpawner.get_pod_manifest_base = KubeSpawner.get_pod_manifest KubeSpawner.get_pod_manifest = spawner_pod_manifest + # let's skip the profile selection form for now + # TODO: for future we can remove this hook + KubeSpawner.options_form = custom_options_form + def spawner_pod_manifest(self: KubeSpawner): print("Cloudharness: changing pod manifest") @@ -22,6 +35,7 @@ def spawner_pod_manifest(self: KubeSpawner): return KubeSpawner.get_pod_manifest_base(self) + def affinity_spec(key, value): return { @@ -38,6 +52,7 @@ def affinity_spec(key, value): 'topologyKey': 'kubernetes.io/hostname' } + def set_user_volume_affinity(self: KubeSpawner): # Add labels to use for affinity labels = { @@ -69,7 +84,7 @@ def change_pod_manifest(self: KubeSpawner): image_plus_tag = task_images[task_image] if ws_image in image_plus_tag: ws_image = image_plus_tag - logging.info(f'Found tag for image: {ws_image}') + logging.error(f'Found tag for image: {ws_image}') break else: if app['name'] != 'jupyterhub': # Would use the hub image in that case, which we don't want.