From c59e637d613e9b19ba5bbec5c081f952646d7544 Mon Sep 17 00:00:00 2001 From: John-Paul Robinson <jpr@uab.edu> Date: Mon, 29 Aug 2022 13:19:07 -0500 Subject: [PATCH] Fix ambigous policy output renaming The mmpolicyapply list output file naming is not well documented. Add job-specific subdir for global and scratch paths to isolate expected files from a job. Rename final tagged result and move it to the provided global output dir and clean up the temporary dir after file completes. Include potential for no output if there are zero matches. --- run-mmpol.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/run-mmpol.sh b/run-mmpol.sh index 7ffa6d5..1f1dfee 100755 --- a/run-mmpol.sh +++ b/run-mmpol.sh @@ -7,8 +7,9 @@ filesystem=${FILESYSTEM:-scratch} policyfile=$POLICYFILE -tmpglobal=$DIR -tmpscratch=$DIR +tmpglobal=$DIR/slurm-tmp-${SLURM_JOBID} +tmpscratch=$DIR/slurm-tmp-${SLURM_JOBID} +mkdir -p $tmpglobal nodes=`scontrol show hostnames "${SLURM_JOB_NODELIST}" | tr '\n' ',' | sed -e 's/,$//'` cores="${SLURM_CPUS_PER_TASK}" @@ -41,4 +42,8 @@ fi # tag output file with run metadata outfile=`ls -t $tmpglobal | head -1` -mv -n $tmpglobal/$outfile $tmpglobal/${outfile}_$filetag +if [[ "$outfile" != "" ]] +then + mv -n $tmpglobal/$outfile $tmpglobal/../${outfile}_$filetag +fi +rmdir $tmpglobal -- GitLab