forked from matthewhirschey/ddh.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubmit-slurm-jobs.sh
executable file
·35 lines (30 loc) · 1.24 KB
/
submit-slurm-jobs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
# setup DDH_EMAIL environment variable
source config.sh
# create flags that will send an email when a job fails or when a job ends(fail or succeed)
FAIL_EMAIL_FLAGS="--mail-type=FAIL --mail-user=$DDH_EMAIL"
DONE_EMAIL_FLAGS="--mail-type=END --mail-user=$DDH_EMAIL"
# make sure we have data and logs directories created
mkdir -p data
mkdir -p logs
# submit sbatch jobs that wait on the previous job to finish
JOB_ID=""
for SCRIPT in data-gen-step1.sh \
data-gen-step2.sh \
data-gen-step3.sh \
data-gen-step4-pos-subsets.sh \
data-gen-step4-neg-subsets.sh \
data-gen-step4-merge-subsets.sh
do
JOB_FLAGS=${FAIL_EMAIL_FLAGS}
if [ "$JOB_ID" != "" ]
then
JOB_FLAGS="$FAIL_EMAIL_FLAGS --dependency=afterok:$JOB_ID"
fi
echo "sbatch ${JOB_FLAGS} --parsable slurm/${SCRIPT}"
JOB_ID=$(sbatch ${JOB_FLAGS} --parsable slurm/${SCRIPT})
echo "Created job $JOB_ID for $SCRIPT"
done
echo "sbatch ${DONE_EMAIL_FLAGS} --job-name="ddh-upload" --dependency=afterok:$JOB_ID slurm/upload-data.sh"
UPLOAD_JOB_ID=$(sbatch ${DONE_EMAIL_FLAGS} --job-name="ddh-upload" --dependency=afterok:$JOB_ID slurm/upload-data.sh)
echo "Created job $JOB_ID for slurm/upload-data.sh"