From b5a1310f253d6d0e282cfbbf348840f5bbc44bea Mon Sep 17 00:00:00 2001 From: Rafael Karampatsis Date: Fri, 22 Nov 2019 15:47:11 +0000 Subject: [PATCH 1/2] Fixed script name for sinline as the original name caused failure. Maybe it was a special snowflake. --- sinline | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sinline b/sinline index a76744a..af722b4 100755 --- a/sinline +++ b/sinline @@ -69,12 +69,13 @@ if [ -z "${sbatch_args}" ]; then sbatch_args="--time=00:30:00" fi -echo '#!/bin/bash' > /tmp/bash_script.sh -echo '#SBATCH -o sbatch_stdout.log' >> /tmp/bash_script.sh -echo '#SBATCH -e sbatch_stderr.log' >> /tmp/bash_script.sh -echo "${cmd}" >> /tmp/bash_script.sh +echo '#!/bin/bash' > /tmp/scription.sh +echo '#SBATCH -o sbatch_stdout.log' >> /tmp/scription.sh +echo '#SBATCH -e sbatch_stderr.log' >> /tmp/scription.sh +echo "${cmd}" >> /tmp/scription.sh +chmod u+x /tmp/scription.sh # make sure it is executable -sbatch --wait ${sbatch_args} -w ${node} /tmp/bash_script.sh +sbatch --wait ${sbatch_args} -w ${node} /tmp/scription.sh wait cat sbatch_stdout.log >&1 @@ -83,5 +84,5 @@ cat sbatch_stderr.log >&2 # Clean up if [ "${cleanup}" -eq "1" ]; then rm sbatch_std{out,err}.log - rm /tmp/bash_script.sh + rm /tmp/scription.sh fi From 2c5b88c1c25baa387d0cfd6b29fae2dd489691fc Mon Sep 17 00:00:00 2001 From: RyanrDavies Date: Thu, 5 Mar 2020 10:39:38 +0000 Subject: [PATCH 2/2] Fix: Add date/username to temp file name Adds the current date/time and username of the submitting user to the name of the temporary file created. This should avoid issues where the temporary file cannot be created because it already exists and belongs to another user. --- sinline | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/sinline b/sinline index af722b4..7564a19 100755 --- a/sinline +++ b/sinline @@ -69,13 +69,18 @@ if [ -z "${sbatch_args}" ]; then sbatch_args="--time=00:30:00" fi -echo '#!/bin/bash' > /tmp/scription.sh -echo '#SBATCH -o sbatch_stdout.log' >> /tmp/scription.sh -echo '#SBATCH -e sbatch_stderr.log' >> /tmp/scription.sh -echo "${cmd}" >> /tmp/scription.sh -chmod u+x /tmp/scription.sh # make sure it is executable +dt=$(date '+%d_%m_%Y__%H_%M_%S') +uname=$(whoami) +TMPFILEPATH=/tmp/bash_script_${uname}_${dt}.sh -sbatch --wait ${sbatch_args} -w ${node} /tmp/scription.sh + +echo '#!/bin/bash' > ${TMPFILEPATH} +echo '#SBATCH -o sbatch_stdout.log' >> ${TMPFILEPATH} +echo '#SBATCH -e sbatch_stderr.log' >> ${TMPFILEPATH} +echo "${cmd}" >> ${TMPFILEPATH} +chmod u+x ${TMPFILEPATH} # make sure it is executable + +sbatch --wait ${sbatch_args} -w ${node} ${TMPFILEPATH} wait cat sbatch_stdout.log >&1 @@ -84,5 +89,5 @@ cat sbatch_stderr.log >&2 # Clean up if [ "${cleanup}" -eq "1" ]; then rm sbatch_std{out,err}.log - rm /tmp/scription.sh + rm ${TMPFILEPATH} fi