From 5927dae59fc926333e5d05c7445ba8b2c6f72619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Fri, 6 Dec 2024 13:38:40 +0100 Subject: [PATCH 1/2] use $JOB_STORAGE as base dir for $SINGULARITY_TMPDIR, if it is defined; fall back to $PWD otherwise --- bot/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/test.sh b/bot/test.sh index d3f3630ea8..820618b477 100755 --- a/bot/test.sh +++ b/bot/test.sh @@ -130,7 +130,7 @@ echo "bot/test.sh: LOAD_MODULES='${LOAD_MODULES}'" # singularity/apptainer settings: CONTAINER, HOME, TMPDIR, BIND CONTAINER=$(cfg_get_value "repository" "container") export SINGULARITY_HOME="${PWD}:/eessi_bot_job" -export SINGULARITY_TMPDIR="${PWD}/singularity_tmpdir" +export SINGULARITY_TMPDIR="${JOB_STORAGE:-${PWD}}/singularity_tmpdir" mkdir -p ${SINGULARITY_TMPDIR} # load modules if LOAD_MODULES is not empty From e4c8b0419c0e0560eace89a597de99fd70b72c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Fri, 6 Dec 2024 13:48:50 +0100 Subject: [PATCH 2/2] move block of code that sets $STORAGE and $JOB_STORAGE out of if statement --- bot/test.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/bot/test.sh b/bot/test.sh index 820618b477..2e2c838dfa 100755 --- a/bot/test.sh +++ b/bot/test.sh @@ -103,19 +103,6 @@ fi RESUME_DIR=$(grep 'Using .* as tmp directory' slurm-${SLURM_JOBID}.out | head -1 | awk '{print $2}') if [[ -z ${RESUME_DIR} ]]; then - echo -n "setting \$STORAGE by replacing any var in '${LOCAL_TMP}' -> " - # replace any env variable in ${LOCAL_TMP} with its - # current value (e.g., a value that is local to the job) - STORAGE=$(envsubst <<< ${LOCAL_TMP}) - echo "'${STORAGE}'" - - # make sure ${STORAGE} exists - mkdir -p ${STORAGE} - - # make sure the base tmp storage is unique - JOB_STORAGE=$(mktemp --directory --tmpdir=${STORAGE} bot_job_tmp_XXX) - echo "bot/test.sh: created unique base tmp storage directory at ${JOB_STORAGE}" - RESUME_TGZ=${PWD}/previous_tmp/build_step/$(ls previous_tmp/build_step) if [[ -z ${RESUME_TGZ} ]]; then echo "bot/test.sh: no information about tmp directory and tarball of build step; --> giving up" @@ -123,6 +110,19 @@ if [[ -z ${RESUME_DIR} ]]; then fi fi +echo -n "setting \$STORAGE by replacing any var in '${LOCAL_TMP}' -> " +# replace any env variable in ${LOCAL_TMP} with its +# current value (e.g., a value that is local to the job) +STORAGE=$(envsubst <<< ${LOCAL_TMP}) +echo "'${STORAGE}'" + +# make sure ${STORAGE} exists +mkdir -p ${STORAGE} + +# make sure the base tmp storage is unique +JOB_STORAGE=$(mktemp --directory --tmpdir=${STORAGE} bot_job_tmp_XXX) +echo "bot/test.sh: created unique base tmp storage directory at ${JOB_STORAGE}" + # obtain list of modules to be loaded LOAD_MODULES=$(cfg_get_value "site_config" "load_modules") echo "bot/test.sh: LOAD_MODULES='${LOAD_MODULES}'"