From b9b2320fff26ca89ddaa5f10bf93eaebe9ec18b3 Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Mon, 2 Oct 2023 15:56:50 +0100 Subject: [PATCH] custom command instead of generic --- jhub_apps/launcher/panel_app.py | 5 ++++- jhub_apps/spawner/spawner_creation.py | 4 ++-- jhub_apps/spawner/types.py | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/jhub_apps/launcher/panel_app.py b/jhub_apps/launcher/panel_app.py index 05f2170c..fb1d5e97 100644 --- a/jhub_apps/launcher/panel_app.py +++ b/jhub_apps/launcher/panel_app.py @@ -156,6 +156,9 @@ def _get_server_apps(username): framework_conf: FrameworkConf = FRAMEWORKS_MAPPING.get( user_options["framework"] ) + if not framework_conf: + print(f"Warning: Framework conf not found for: {user_options['framework']}") + continue app = App( name=server_name, filepath=user_options["filepath"], @@ -344,7 +347,7 @@ def get_input_form_widget(): ) def framework_handler(selected_framework): - if selected_framework == Framework.generic.value: + if selected_framework == Framework.custom.value: input_form_widget.custom_command.visible = True else: input_form_widget.custom_command.visible = False diff --git a/jhub_apps/spawner/spawner_creation.py b/jhub_apps/spawner/spawner_creation.py index f0333386..3e030a33 100644 --- a/jhub_apps/spawner/spawner_creation.py +++ b/jhub_apps/spawner/spawner_creation.py @@ -27,7 +27,7 @@ def get_args(self): app_filepath = None if framework not in [ Framework.jupyterlab.value, - Framework.generic.value, + Framework.custom.value, ]: app_filepath = filepath or EXAMPLES_DIR / EXAMPLES_FILE.get( framework @@ -38,7 +38,7 @@ def get_args(self): self.user_options["filepath"] = str(app_filepath) custom_cmd = self.user_options.get("custom_command") - if framework == Framework.generic.value: + if framework == Framework.custom.value: assert custom_cmd command = Command(args=GENERIC_ARGS + custom_cmd.split()) else: diff --git a/jhub_apps/spawner/types.py b/jhub_apps/spawner/types.py index c6f40247..b54bda27 100644 --- a/jhub_apps/spawner/types.py +++ b/jhub_apps/spawner/types.py @@ -30,7 +30,7 @@ class Framework(Enum): voila = "voila" gradio = "gradio" jupyterlab = "jupyterlab" - generic = "generic" + custom = "custom" @classmethod def values(cls): @@ -74,8 +74,8 @@ def values(cls): logo="https://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Jupyter_logo.svg/1200px-Jupyter_logo.svg.png", ), FrameworkConf( - name=Framework.generic.value, - display_name="Generic", + name=Framework.custom.value, + display_name="Custom Command", logo="https://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Jupyter_logo.svg/1200px-Jupyter_logo.svg.png", ), ]