Skip to content

Instantly share code, notes, and snippets.

@lkluft
Created May 16, 2017 07:51
Show Gist options
  • Save lkluft/27cc04a18b698a0e27c56da501b009e9 to your computer and use it in GitHub Desktop.
Save lkluft/27cc04a18b698a0e27c56da501b009e9 to your computer and use it in GitHub Desktop.
SLURM job dependency
#!/bin/bash
#SBATCH --job-name=main
#SBATCH --output=main-%j.out
#SBATCH --error=main-%j.err
#SBATCH --account=uni
#SBATCH --partition=uni-u237
#SBATCH --nodes=1-1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
cat current_date.txt && rm current_date.txt
#!/bin/bash
#SBATCH --job-name=preprocessing
#SBATCH --output=preprocessing-%j.out
#SBATCH --error=preprocessing-%j.err
#SBATCH --account=uni
#SBATCH --partition=uni-u237
#SBATCH --nodes=1-1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
sleep 10
date >> current_date.txt
#! /bin/bash
# Catch return value but print it on STDOUT.
RET="$(sbatch pre.job)" && echo $RET
# Send main job to queue (dependent on previous JOB-ID).
sbatch --dependency=afterok:${RET##* } main.job
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment