User Tools

Site Tools


job_dependencies

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
job_dependencies [2014/11/04 22:11]
root created
job_dependencies [2014/11/04 22:59] (current)
root
Line 3: Line 3:
 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.
  
-<ode>+This code uses **srun -d afterok:NNNNN** to wait for some jobs submitted using sbatch to complete. 
 + 
 +**Warning:** This only seems to work if you run the control script directly on the head node! (i.e. if you use sbatch or srun to execute the script the code does not actually wait for the dependencies to complete). Not sure why. 
 + 
 +<code>
 #!/bin/bash #!/bin/bash
-p=$1 
  
 dependencies="afterok" dependencies="afterok"
 while read pheno; do while read pheno; do
 if [ -n "${pheno}" ]; then 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 ' ' )`+  job = `( sbatch -o $pheno.%j.out prepare_pheno $p $pheno | cut -f 4 -d ' ' )`
   dependencies+=:$job   dependencies+=:$job
 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 "All model_eval_cv_genotyped.sh done"+srun -d $dependencies echo "All phenotype preparation done"
  
-# Run for each chromosome/chunk+# Run for each chromosome
 dependencies="afterok" dependencies="afterok"
-for chr in {1..22} {101..112};do +for chr in {1..22}; 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 ' ')`+  job = `(sbatch -o chr${chr}.%j.out run_model.sh $p $chr | cut -f 1 -d ' ')`
   dependencies+=:$job   dependencies+=:$job
 done done
  
 # Wait for these jobs to complete (trick) # Wait for these jobs to complete (trick)
-srun -d $dependencies echo "All model_eval_cv_imputed.sh done"+srun -d $dependencies echo "All analyses done" 
 + 
 +# Do more stuff... 
 </code> </code>
  
  
job_dependencies.1415157115.txt.gz · Last modified: 2014/11/04 22:11 by root