Skip to content

Instantly share code, notes, and snippets.

@wtbarnes
Last active September 28, 2016 19:57
Show Gist options
  • Save wtbarnes/38dcc3ee90aaa2f914a393b079539177 to your computer and use it in GitHub Desktop.
Save wtbarnes/38dcc3ee90aaa2f914a393b079539177 to your computer and use it in GitHub Desktop.
Chain a bunch of Torque/PBS jobs together, pulling arguments from a config file
#!/bin/bash
#chain some torque jobs together with dependencies
#set parameters
start_job=$1
start_index=0
end_index=41
conf_file=/home/wtb2/Documents/em_analysis.conf
#read config file
IFS=$'\n' read -d '' -r -a conf < $conf_file
for i in `seq $start_index $end_index`
do
#write to temporary file
echo "/home/wtb2/Documents/EBTEL_analysis/bin/ebtel_dem_analysis_main.py "${conf[$(($i))]} > tmp_queup
chmod u+x tmp_queup
if [[ $i -eq $start_index ]]; then
qsub -N "em_analysis_${i}" -j oe ./tmp_queup
else
qsub -N "em_analysis_${i}" -j oe -W depend=afterok:$(($start_job+$i-$start_index-1)) ./tmp_queup
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment