Newer
Older
#!/bin/bash
set -euxo pipefail
############################################################
# Default Values #
############################################################
nodes=1
mem_per_cpu="8G"
time="24:00:00"
partition="amd-hdr100,medium"
outdir="/data/rc/gpfs-policy/data"
policy="./policy/list-path-external"
############################################################
# Help #
############################################################
usage()
{
>&2 cat << EOF
Usage: $0 [ -h ] [ -o | --outdir ] [ -f | --outfile ] [ --with-dirs ]
[ -N | --nodes ] [ -c | --cores ] [ -p | --partition]
[ -t | --time ] [ -m | --mem-per-cpu ]
device
EOF
exit 1
}
help()
{
>&2 cat << EOF
Wraps the run-mmpol.sh script for applying a policy file. Must be run directly
as root or via the run-submit-pol-job.py script. The default policy file is
./policy/list-path-external
Usage: $0 [ -h ] [ -o | --outdir ] [ -f | --outfile ] [ --with-dirs ]
[ -N | --nodes ] [ -c | --cores ] [ -p | --partition ]
[ -t | --time ] [ -m | --mem ]
device
options:
-h|--help Print this Help.
Required:
device GPFS fileset/directory apply the policy to. Can be
specified as either the name of the fileset or the
full path to the directory
(Examples: scratch, /data/user/[username])
Path:
-o|--outdir Parent directory to save policy output to
(default: /data/rc/gpfs-policy/data)
-f|--outfile Name of the policy output file
Policy Options:
--with-dirs Change to ./policy/list-path-dirplus (default: False)
sbatch options:
-N|--nodes Number of nodes to run the job on (default: 1)
-p|--partition Partition to submit tasks to
(default: amd-hdr100,medium)
-t|--time Max walltime (default: 24:00:00)
-m|--mem-per-cpu RAM per task (default: 8G)
EOF
exit 0
}
args=$(getopt -a -o ho:f:N:c:p:t:m: --long help,outdir:,outfile:,with-dirs,nodes:,cores:,partition:,time:,mem: -- "$@")
if [[ $? -gt 0 ]]; then
usage
fi
eval set -- ${args}
while :
do
case $1 in
-h | --help) help ;;
-o | --outdir) outdir=$2 ; shift 2 ;;
-f | --outfile) outfile=$2 ; shift 2 ;;
--with-dirs) policy="./policy/list-path-dirplus" ; shift 1 ;;
-N | --nodes) nodes=$2 ; shift 2 ;;
-p | --partition) partition=$2 ; shift 2 ;;
-t | --time) time=$2 ; shift 2 ;;
-m | --mem-per-cpu) mem_per_cpu=$2 ; shift 2 ;;
--) shift; break ;;
*) >&2 echo Unsupported option: $1
usage ;;
esac
done
if [[ $# -eq 0 ]]; then
usage
fi
device="$1"
# Ensure gpfs_logdir is set
if [[ -z "$device" ]]; then
echo "Error: Specify either the name of a fileset or a directory path"
usage
fi
DIR=$outdir POLICYFILE=$policy FILESYSTEM=${device} OUTFILE=${outfile} && \
DIR=$DIR POLICYFILE=$POLICYFILE FILESYSTEM=${FILESYSTEM} OUTFILE=${OUTFILE} \
sbatch \
-N $nodes \
--mem-per-cpu=$mem_per_cpu \
-p $partition \
./run-mmpol.sh