From ed6bab42934549455f5b5f72b85f042ba1537b81 Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Mon, 8 Jan 2024 01:13:49 +0000 Subject: [PATCH] extract services to func --- jupyterhub_config.py | 87 +++++++++++--------------------------------- 1 file changed, 21 insertions(+), 66 deletions(-) diff --git a/jupyterhub_config.py b/jupyterhub_config.py index 91578683..355e4062 100644 --- a/jupyterhub_config.py +++ b/jupyterhub_config.py @@ -20,74 +20,29 @@ c = install_jhub_apps(c, spawner_to_subclass=SimpleLocalProcessSpawner) c.JupyterHub.template_paths = theme_template_paths + + +def service_for_jhub_apps(name, url): + return { + "name": name, + "url": hub_url, + "display": True, + "info": { + "name": name, + "url": url, + "external": True, + }, + "oauth_no_confirm": True, + } + + c.JupyterHub.services.extend( [ - { - "name": "JuypterLab", - "url": hub_url, - "display": True, - "info": { - "name": "JupyterLab", - "url": "/user/[USER]/lab", - "external": True, - }, - "oauth_no_confirm": True, - }, - { - "name": "Argo", - "url": hub_url, - "display": True, - "info": { - "name": "Argo Workflows", - "url": "/hub/argo", - "external": True, - }, - "oauth_no_confirm": True, - }, - { - "name": "Users", - "url": hub_url, - "display": True, - "info": { - "name": "User Management", - "url": "/auth/admin/nebari/console/", - "external": True, - }, - "oauth_no_confirm": True, - }, - { - "name": "Environments", - "url": hub_url, - "display": True, - "info": { - "name": "Environments", - "url": "/hub/conda-store", - "external": True, - }, - "oauth_no_confirm": True, - }, - { - "name": "Monitoring", - "url": hub_url, - "display": True, - "info": { - "name": "Monitoring", - "url": "/hub/monitoring", - "external": True, - }, - "oauth_no_confirm": True, - }, - { - "name": "MLflow", - "url": "http://mlflow.mlflow:5000", - "display": True, - "info": { - "name": "MLflow", - "url": "http://mlflow.mlflow:5000", - "external": True, - }, - "oauth_no_confirm": True, - }, + service_for_jhub_apps(name="JupyterLab", url="/user/[USER]/lab"), + service_for_jhub_apps(name="Argo", url="/argo"), + service_for_jhub_apps(name="Users", url="/auth/admin/nebari/console/"), + service_for_jhub_apps(name="Environments", url="/conda-store"), + service_for_jhub_apps(name="Monitoring", url="/monitoring"), ] )