Skip to content
Snippets Groups Projects
Commit 661dfd38 authored by Mathis Rosenhauer's avatar Mathis Rosenhauer
Browse files

Simplified job submission

parent 72a991ac
No related branches found
No related tags found
No related merge requests found
......@@ -37,7 +37,7 @@ clean_up () {
if [[ ${job_id} ]]; then
# Clean up temp files and cancel job
local tmp_files="vnc.job vnc.out vnc.out_DKRZepilog vnc_runscript vnc_gethost"
local tmp_files="vnc.job vnc.out vnc.out_DKRZepilog vnc_gethost"
ssh ${USERNAME}@mistral.dkrz.de "scancel ${job_id}; sleep 1; cd .startvnc && rm -f ${tmp_files}" 2> /dev/null
fi
......@@ -49,33 +49,17 @@ clean_up () {
trap "clean_up \"\${job_id}\" \"\${vnc_host_display}\" \"\${xvnc_pid}"\" SIGINT SIGQUIT SIGTERM
ssh ${USERNAME}@mistral.dkrz.de 'mkdir -p .startvnc'
ssh ${USERNAME}@mistral.dkrz.de 'cat > .startvnc/vnc_runscript' <<'EOF_runscript'
#!/bin/bash
cd "${0%/*}"
ACCTCODE="$1"
GEOMETRY="$2"
TIME="$3"
QOS="$4"
JOBSCRIPT=vnc.job
LOGFILE=vnc.out
(
cat <<EOF
ssh ${USERNAME}@mistral.dkrz.de 'mkdir -p .startvnc; cat > .startvnc/vnc.job' <<EOF
#!/bin/bash
#SBATCH --partition=gpu
#SBATCH --ntasks=12
#SBATCH --qos=${QOS}
#SBATCH --time=${TIME}
#SBATCH --account=${ACCTCODE}
#SBATCH --output=${LOGFILE}
#SBATCH --output=vnc.out
/opt/TurboVNC/bin/vncserver -fg -geometry ${GEOMETRY}
EOF
) > ${JOBSCRIPT}
job_id=$(sbatch ${JOBSCRIPT} | grep -Eoe "\b[0-9]+$")
echo ${job_id}
EOF_runscript
ssh ${USERNAME}@mistral.dkrz.de 'cat > .startvnc/vnc_gethost' <<'EOF'
#!/bin/bash
......@@ -85,17 +69,14 @@ while [ -z ${vnc_host_display} ]; do
sleep 1
vnc_host_display=$(grep "started on display" ${LOGFILE} 2> /dev/null | grep -Eoe "\bmg[0-9]+:[0-9]$")
done
xvnc_pid=$(cat ${HOME}/.vnc/${vnc_host_display}.pid)
echo ${vnc_host_display} ${xvnc_pid}
echo ${vnc_host_display}
EOF
job_id=$(ssh ${USERNAME}@mistral.dkrz.de "/bin/bash .startvnc/vnc_runscript ${ACCTCODE} ${GEOMETRY} ${TIME} ${QOS}")
vars=$(ssh ${USERNAME}@mistral.dkrz.de "/bin/bash .startvnc/vnc_gethost")
if [[ "${vars}" ]]; then
vnc_host_display=$(echo ${vars} | cut -d' ' -f1)
xvnc_pid=$(echo ${vars} | cut -d' ' -f2)
job_id=$(ssh ${USERNAME}@mistral.dkrz.de "cd .startvnc && sbatch vnc.job" | grep -Eoe "\b[0-9]+$")
vnc_host_display=$(ssh ${USERNAME}@mistral.dkrz.de "/bin/bash .startvnc/vnc_gethost")
xvnc_pid=$(ssh ${USERNAME}@mistral.dkrz.de "cat .vnc/${vnc_host_display}.pid")
if [[ ${vnc_host_display} && ${xvnc_pid} ]]; then
# Start VNC client
if [[ "${PASSWORD}" = true ]]; then
scp ${USERNAME}@mistral.dkrz.de:~/.vnc/passwd ~/.vnc/passwd2
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment