From 9a409a6acf1c4520a5ad84a15937676e8dbad24c Mon Sep 17 00:00:00 2001
From: John-Paul Robinson <jpr@uab.edu>
Date: Mon, 14 Mar 2022 17:34:18 -0500
Subject: [PATCH] Feat: add filesystem parameter to run scripts to replace hard
 coded scratch

This allows policy files for any gpfs filesystem to be run by the
run scripts by using a variable for filesystem rather than hard
coding.
Keep default value set to scratch for compatability with existing callers.
Now can include a seventh arg to invoke policy file on any gpfs
filesystem.
---
 run-mmpol.sh   | 3 ++-
 submit-pol-job | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/run-mmpol.sh b/run-mmpol.sh
index 0e493ba..1216b9c 100755
--- a/run-mmpol.sh
+++ b/run-mmpol.sh
@@ -5,6 +5,7 @@
 # gather info to map mmapplypolicy to runtime configuration
 # arguments passed via job env and runtime context
 
+filesystem=${FILESYSTEM:-scratch}
 policyfile=$POLICYFILE
 tmpglobal=$DIR
 tmpscratch=$DIR
@@ -17,7 +18,7 @@ DATESTR=`date +'%Y-%m-%d-%H:%M:%S'`
 policy=`basename $policyfile`
 filetag="${policy}_slurm-${SLURM_JOBID}_${DATESTR}"
 
-cmd="mmapplypolicy scratch -I prepare \
+cmd="mmapplypolicy ${filesystem} -I prepare \
   -P $policyfile \
   -g $tmpglobal \
   -s $tmpscratch \
diff --git a/submit-pol-job b/submit-pol-job
index 3b429f3..0d911b7 100755
--- a/submit-pol-job
+++ b/submit-pol-job
@@ -8,9 +8,10 @@ nodes=$3
 cores=$4
 ram=$5
 partition=$6
+filesystem=${7:-scratch}
 
-DIR=$outdir POLICYFILE=$policy && \
-DIR=$DIR POLICYFILE=$POLICYFILE \
+DIR=$outdir POLICYFILE=$policy FILESYSTEM=${filesystem} && \
+DIR=$DIR POLICYFILE=$POLICYFILE FILESYSTEM=${FILESYSTEM} \
 sbatch \
    -N $nodes \
    -c $cores \
-- 
GitLab