Commit 3dadacb3 authored by Mathis Rosenhauer's avatar Mathis Rosenhauer
Browse files

Merge branch 'k204213/ssh_scripts-master'

parents a96e50ef 53a97b80
...@@ -93,6 +93,11 @@ SJ_INCFILE="" ...@@ -93,6 +93,11 @@ SJ_INCFILE=""
# where jupyter is running need a shared home file system. # where jupyter is running need a shared home file system.
readonly SJ_FRONTEND_HOST="mistralpp.dkrz.de" readonly SJ_FRONTEND_HOST="mistralpp.dkrz.de"
# Image
#
# start the jupyter notebook in a singularity container from a given
# image name.
SJ_IMAGE=""
function clean_up () { function clean_up () {
trap - ERR EXIT trap - ERR EXIT
...@@ -134,6 +139,7 @@ Available values for OPTION include: ...@@ -134,6 +139,7 @@ Available values for OPTION include:
-i file source file prior to running jupyter -i file source file prior to running jupyter
-n ntasks request ntasks tasks for job -n ntasks request ntasks tasks for job
-p partition run job on partition -p partition run job on partition
-s image singularity image
-t time job runtime -t time job runtime
-u username use username for login -u username use username for login
...@@ -142,7 +148,7 @@ EOF ...@@ -142,7 +148,7 @@ EOF
function parse_options () { function parse_options () {
local option local option
while getopts 'A:c:di:n:p:t:u:' option; do while getopts 'A:c:di:n:p:s:t:u:' option; do
case ${option} in case ${option} in
A) SJ_ACCTCODE="$OPTARG" A) SJ_ACCTCODE="$OPTARG"
;; ;;
...@@ -156,6 +162,8 @@ function parse_options () { ...@@ -156,6 +162,8 @@ function parse_options () {
;; ;;
p) SJ_PARTITION="$OPTARG" p) SJ_PARTITION="$OPTARG"
;; ;;
s) SJ_IMAGE="$OPTARG"
;;
t) SJ_RUNTIME="$OPTARG" t) SJ_RUNTIME="$OPTARG"
;; ;;
u) SJ_USERNAME="$OPTARG" u) SJ_USERNAME="$OPTARG"
...@@ -173,6 +181,7 @@ function parse_options () { ...@@ -173,6 +181,7 @@ function parse_options () {
readonly SJ_PARTITION readonly SJ_PARTITION
readonly SJ_RUNTIME readonly SJ_RUNTIME
readonly SJ_USERNAME readonly SJ_USERNAME
readonly SJ_IMAGE
} }
function ssh_frontend () { function ssh_frontend () {
...@@ -216,6 +225,9 @@ function assemble_commandline () { ...@@ -216,6 +225,9 @@ function assemble_commandline () {
if [[ -z ${SJ_ACCTCODE} ]]; then if [[ -z ${SJ_ACCTCODE} ]]; then
commandline="nohup ${commandline} > /dev/null & echo \$!" commandline="nohup ${commandline} > /dev/null & echo \$!"
fi fi
if [[ -n ${SJ_IMAGE} ]]; then
commandline="singularity exec ${SJ_IMAGE} ${commandline}"
fi
commandline="$(source_incfile "${commandline}")" commandline="$(source_incfile "${commandline}")"
echo "${commandline}" echo "${commandline}"
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment