This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
job_dependencies [2014/11/04 22:12] root |
job_dependencies [2014/11/04 22:59] (current) root |
||
---|---|---|---|
Line 2: | Line 2: | ||
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. | 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. | ||
+ | |||
+ | This code uses **srun -d afterok: | ||
+ | |||
+ | **Warning: | ||
< | < | ||
#!/bin/bash | #!/bin/bash | ||
- | p=$1 | ||
dependencies=" | dependencies=" | ||
while read pheno; do | while read pheno; do | ||
if [ -n " | if [ -n " | ||
- | job = `( sbatch -o $p/ | + | job = `( sbatch -o $pheno.%j.out |
dependencies+=: | dependencies+=: | ||
fi | fi | ||
- | done < $p/phenotypes.txt | + | done < phenotypes.txt |
# Wait for these jobs to complete (trick) | # Wait for these jobs to complete (trick) | ||
- | srun -d $dependencies echo " | + | srun -d $dependencies echo " |
- | # Run for each chromosome/chunk | + | # Run for each chromosome |
dependencies=" | dependencies=" | ||
- | for chr in {1..22} {101..112};do | + | for chr in {1..22}; do |
- | job = `(sbatch | + | job = `(sbatch -o chr${chr}.%j.out |
dependencies+=: | dependencies+=: | ||
done | done | ||
# Wait for these jobs to complete (trick) | # Wait for these jobs to complete (trick) | ||
- | srun -d $dependencies echo " | + | srun -d $dependencies echo " |
+ | |||
+ | # Do more stuff... | ||
</ | </ | ||