From c0f012917cd0d70a401837fa8d651694992914b5 Mon Sep 17 00:00:00 2001
From: k204213 <bendoukha@dkrz.de>
Date: Wed, 14 Apr 2021 11:54:55 +0200
Subject: [PATCH] Enable starting jupyter notebook on different frontend.

---
 README.md     | 10 +++++++++-
 start-jupyter | 18 ++++++++++++------
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index 67980ab..79e1474 100644
--- a/README.md
+++ b/README.md
@@ -6,4 +6,12 @@ tunnel set-up, and start the client application on your local system.
 
 As bash scripts they run natively on Linux, MacOS, and other Unix-like
 systems. After installing WSL (Windows Subsystem for Linux), they also run
-on Microsoft Windows 10.
\ No newline at end of file
+on Microsoft Windows 10.
+
+## start-jupyter
+
+The script is being modified to allow further features:
+
+* connecting to different DKRZ systems: mistral, vader, levante (?)
+* start jupyter notebooks in singularity containers 
+
diff --git a/start-jupyter b/start-jupyter
index 1123dd7..7bcc788 100755
--- a/start-jupyter
+++ b/start-jupyter
@@ -44,6 +44,7 @@
 # In case of problems contact Mathis Rosenhauer <rosenhauer@dkrz.de>.
 #
 # 2020, Oct. 7, S. Bendoukha, added support for singularity containers.
+# 2021, Apr. 14, S. Bendoukha, added option to specify frontend.
 
 set -eufo pipefail
 
@@ -92,7 +93,7 @@ SJ_INCFILE=""
 #
 # Must be directly accessible from client. The frontend and the node
 # where jupyter is running need a shared home file system.
-readonly SJ_FRONTEND_HOST="mistralpp.dkrz.de"
+SJ_FRONTEND_HOST="mistralpp.dkrz.de"
 
 # Image
 #
@@ -137,19 +138,21 @@ Available values for OPTION include:
   -A acctcode    start a job with acctcode
   -c command     invoke jupyter with command
   -d             check for presence of jupyter
+  -f system      mistral, vader
   -i file        source file prior to running jupyter
   -n ntasks      request ntasks tasks for job
   -p partition   run job on partition
+  -s image       singularity image
   -t time        job runtime
   -u username    use username for login
-  -s image       singularity image
+  
 
 EOF
 }
 
 function parse_options () {
     local option
-    while getopts 'A:c:di:n:p:t:u:s:' option; do
+    while getopts 'A:c:di:f:n:p:t:u:s:' option; do
         case ${option} in
             A) SJ_ACCTCODE="$OPTARG"
                ;;
@@ -157,18 +160,20 @@ function parse_options () {
                ;;
             d) SJ_DEBUG=1
                ;;
+            f) SJ_FRONTEND_HOST="$OPTARG"
+               ;;
             i) SJ_INCFILE="$OPTARG"
                ;;
             n) SJ_NTASKS="$OPTARG"
                ;;
             p) SJ_PARTITION="$OPTARG"
                ;;
+            s) SJ_IMAGE="$OPTARG"
+               ;;
             t) SJ_RUNTIME="$OPTARG"
                ;;
             u) SJ_USERNAME="$OPTARG"
                ;;
-            s) SJ_IMAGE="$OPTARG"
-               ;;
             ?) usage
             exit 1
             ;;
@@ -183,6 +188,7 @@ function parse_options () {
     readonly SJ_RUNTIME
     readonly SJ_USERNAME
     readonly SJ_IMAGE
+    readonly SJ_FRONTEND_HOST
 }
 
 function ssh_frontend () {
@@ -206,7 +212,7 @@ function source_incfile() {
         fi
         commandline="source ${incfile}; ${commandline}"
     else
-        commandline="module load python3/unstable; ${commandline}"
+        commandline="module use /sw/spack-rhel6/spack/modules/linux-rhel6-haswell/; module load python3/unstable; ${commandline}"
     fi
     echo "${commandline}"
 }
-- 
GitLab