This is an automated email from the ASF dual-hosted git repository.

lahirujayathilake pushed a commit to branch cybershuttle-staging
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/cybershuttle-staging by this 
push:
     new 94e814e843 jupyterhub instance to show sample notebooks
94e814e843 is described below

commit 94e814e84338b531caf4fe7d74cbc673c907e4ea
Author: lahiruj <[email protected]>
AuthorDate: Mon Mar 31 03:51:29 2025 -0400

    jupyterhub instance to show sample notebooks
---
 .../research-hub/compose/jupyterhub_config.py      | 39 +++++++++++-----------
 .../compose/user-container/build-container.sh      |  4 +--
 .../research-hub/compose/user-container/init.sh    |  1 -
 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git 
a/modules/research-framework/research-hub/compose/jupyterhub_config.py 
b/modules/research-framework/research-hub/compose/jupyterhub_config.py
index f829ff1d51..d6d3339154 100644
--- a/modules/research-framework/research-hub/compose/jupyterhub_config.py
+++ b/modules/research-framework/research-hub/compose/jupyterhub_config.py
@@ -39,11 +39,6 @@ class CustomDockerSpawner(DockerSpawner):
 
         return options
 
-    def get_image(self):
-        user_requested = self.user_options.get("image", "base")
-        default_image = "cybershuttle/dev_jupyterlab-base"
-        return self.allowed_images.get(user_requested, default_image)
-
     def sanitize_name(self, name):
         """Docker safe volume/container names."""
         return re.sub(r"[^a-zA-Z0-9_.-]", "_", name)
@@ -54,24 +49,31 @@ class CustomDockerSpawner(DockerSpawner):
         safe_user = self.sanitize_name(self.user.name)
         safe_srv = self.sanitize_name(self.name) or "default"
 
-        vol_name = f"jupyterhub-vol-{safe_user}-{safe_srv}"
-
-        volumes_dict = {
-            vol_name: "/home/jovyan/work"
-        }
+        volumes_dict = {}
 
-        # If dataPath was provided, mount it read-only
+        git_url = self.user_options.get("git")
         data_subfolder = self.user_options.get("dataPath")
-        if data_subfolder:
-            host_data_path = f"/home/exouser/mnt/{data_subfolder}"
-            volumes_dict[host_data_path] = {
-                'bind': f"/home/jovyan/shared_data_tmp",
-                'mode': 'ro'
-            }
+
+        if git_url or data_subfolder:
+            vol_name = f"jupyterhub-vol-{safe_user}-{safe_srv}"
+            volumes_dict[vol_name] = "/home/jovyan/work"
+
+            # If a data subfolder is provided, mount it read-only.
+            if data_subfolder:
+                host_data_path = f"/home/exouser/mnt/{data_subfolder}"
+                volumes_dict[host_data_path] = {
+                    'bind': "/home/jovyan/shared_data_tmp",
+                    'mode': 'ro'
+                }
+            self.image = "cybershuttle/jupyterlab-base" # TODO using ENV 
variable
+        else:
+            # Sample mode
+            vol_name = f"jupyterhub-vol-{safe_user}-default-jupyterlab-base"
+            volumes_dict[vol_name] = "/home/jovyan/work"
+            self.image = "cybershuttle/jupyterlab-base-sample" # TODO using 
ENV variable
 
         self.volumes = volumes_dict
 
-        git_url = self.user_options.get("git")
         if git_url:
             if not hasattr(self, "environment"):
                 self.environment = {}
@@ -94,7 +96,6 @@ c.DockerSpawner.environment = {
 c.DockerSpawner.extra_create_kwargs = {'user': 'root'}
 c.DockerSpawner.use_internal_ip = True
 c.DockerSpawner.network_name = os.getenv('DOCKER_NETWORK_NAME', 
'jupyterhub_network')
-c.DockerSpawner.image = os.environ.get('DOCKER_NOTEBOOK_IMAGE', 
'jupyter/base-notebook:latest')
 
 # Hub Configuration
 c.JupyterHub.hub_ip = '0.0.0.0'
diff --git 
a/modules/research-framework/research-hub/compose/user-container/build-container.sh
 
b/modules/research-framework/research-hub/compose/user-container/build-container.sh
index 18bc1d1a25..4270dc6676 100755
--- 
a/modules/research-framework/research-hub/compose/user-container/build-container.sh
+++ 
b/modules/research-framework/research-hub/compose/user-container/build-container.sh
@@ -1,2 +1,2 @@
-docker build --platform linux/x86_64 -t cybershuttle/dev_jupyterlab-base .
-docker push cybershuttle/dev_jupyterlab-base
\ No newline at end of file
+docker build --platform linux/x86_64 -t cybershuttle/jupyterlab-base .
+docker push cybershuttle/jupyterlab-base
\ No newline at end of file
diff --git 
a/modules/research-framework/research-hub/compose/user-container/init.sh 
b/modules/research-framework/research-hub/compose/user-container/init.sh
index 4ec7cb2c06..c1899e19c7 100755
--- a/modules/research-framework/research-hub/compose/user-container/init.sh
+++ b/modules/research-framework/research-hub/compose/user-container/init.sh
@@ -7,7 +7,6 @@ mkdir -p "$TARGET_DIR"
 
 if [ ! -f "$TARGET_DIR/.initialized" ]; then
     echo "Copying default Docker files into the mounted workspace..."
-#    cp -r /tmp/default_data/. "$TARGET_DIR/"
     touch "$TARGET_DIR/.initialized"
     chown -R jovyan:users "$TARGET_DIR"
 

Reply via email to