This is an old revision of the document!
Using sbatch or srun you can make the start of your job dependent on the successful completion (or failure) of a prior job. This could be useful if you have some data preparation to do, followed by your analysis.
<ode> #!/bin/bash p=$1
dependencies=“afterok” while read pheno; do if [ -n “${pheno}” ]; then
job = `( sbatch -o $p/sbatch_logs/chr0.$pheno.%j.out ./bin/model_eval_cv_genotyped.sh $p $pheno | cut -f 4 -d ' ' )` dependencies+=:$job
fi done < $p/phenotypes.txt
# Wait for these jobs to complete (trick) srun -d $dependencies echo “All model_eval_cv_genotyped.sh done”
# Run for each chromosome/chunk dependencies=“afterok” for chr in {1..22} {101..112};do
job = `(sbatch -N 1 -n 1 -o $p/sbatch_logs/chr${chr}.cv.%j.out ./bin/rotroff_scripts/model_eval_cv_imputed.sh $p $chr | cut -f 1 -d ' ')` dependencies+=:$job
done
# Wait for these jobs to complete (trick) srun -d $dependencies echo “All model_eval_cv_imputed.sh done” </code>