Skip to content
Snippets Groups Projects
Commit 833f1419 authored by Mike Boss's avatar Mike Boss
Browse files

Save jobid in variable by saving to file temporarily

parent 3b129b72
No related branches found
No related tags found
No related merge requests found
......@@ -297,8 +297,8 @@ ENDSSH
# run the code-server job on Euler and save the ip of the compute node in the file vscip in the home directory of the user on Euler
echo -e "Connecting to $VSC_HOSTNAME to start the code-server in a batch job"
# FIXME: save jobid in a variable, that the script can kill the batch job at the end
ssh $VSC_SSH_OPT bsub -n $VSC_NUM_CPU -W $VSC_RUN_TIME -R "rusage[mem=$VSC_MEM_PER_CPU_CORE]" $VSC_SNUM_GPU <<ENDBSUB
ssh $VSC_SSH_OPT bsub -n $VSC_NUM_CPU -W $VSC_RUN_TIME -R "rusage[mem=$VSC_MEM_PER_CPU_CORE]" $VSC_SNUM_GPU > BJOB_ID_FILE<<ENDBSUB
module load $VSC_MODULE_COMMAND
export XDG_RUNTIME_DIR="\$HOME/vsc_runtime"
VSC_IP_REMOTE="\$(hostname -i)"
......@@ -306,6 +306,9 @@ echo "Remote IP:\$VSC_IP_REMOTE" >> /cluster/home/$VSC_USERNAME/vscip
code-server --bind-addr=\${VSC_IP_REMOTE}:8899
ENDBSUB
BJOB_ID=$(cat BJOB_ID_FILE | awk '{print $2}'| sed 's/[><]//g')
rm BJOB_ID_FILE
# wait until batch job has started, poll every $VSC_WAITING_INTERVAL seconds to check if /cluster/home/$VSC_USERNAME/vscip exists
# once the file exists and is not empty the batch job has started
ssh $VSC_SSH_OPT <<ENDSSH
......@@ -354,6 +357,7 @@ Remote port : $VSC_REMOTE_PORT
Local port : $VSC_LOCAL_PORT
SSH tunnel : ssh $VSC_SSH_OPT -L $VSC_LOCAL_PORT:$VSC_REMOTE_IP:$VSC_REMOTE_PORT -N &
URL : http://localhost:$VSC_LOCAL_PORT
BJOB ID : $BJOB_ID
EOF
# setup SSH tunnel from local computer to compute node via login node
......
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