Skip to content
Snippets Groups Projects
run-mmpol.sh 640 B
Newer Older
#!/bin/bash

# run an mmapply policy across the cluster via slurm

# gather info to map mmapplypolicy to runtime configuration
# arguments passed via job env and runtime context

policyfile=$POLICYFILE
tmpglobal=$DIR
tmpscratch=$DIR

nodes=`scontrol show hostnames "${SLURM_JOB_NODELIST}" | tr '\n' ',' | sed -e 's/,$//'`
cores="${SLURM_CPUS_PER_TASK}"

DATESTR=`date +'%Y-%m-%d-%H:%M:%S'`

filetag=$policyfile_$DATESTR

cmd="mmapplypolicy scratch -I prepare \
  -P $policyfile \
  -g $tmpglobal \
  -s $tmpscratch \
  -M "FILETAG=$filetag"
  -N ${nodes} -n ${cores}"

# report final command in job log
echo $cmd

# run policy command
$cmd