-
Notifications
You must be signed in to change notification settings - Fork 0
/
mT_submitAllJobs.sh
40 lines (33 loc) · 1.12 KB
/
mT_submitAllJobs.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
36
37
38
39
40
#!/bin/bash
# Submits all jobs which don't have an associated results file.
# INPUT
# $1 Directory in which to look for jobs. Results will be saved here.
# All relevant scripts should be in a folder (or subfolder) of
# this directory named "scripts".
# HISTORY
# Reviewed 16.01.2024
jobDirectory=$1
# Loop through all job files in the direcotry
for filename in $jobDirectory/*job.mat; do
# Does this job already have a results file or a partial results file?
rootName=${filename:0:$((${#filename} - 7))}
resultFile=$rootName"1_result_PACKED.mat"
partialFile=$rootName"1_result_PARTIAL.mat"
if [ ! -f "$resultFile" ]
then
if [ ! -f "$partialFile" ]
then
# Submit the job
sbatch ./mT_runOneJob.sh "$jobDirectory" "$filename" "0"
echo "Starting ..."
echo "$filename"
echo " "
else
# Resume the job
sbatch ./mT_runOneJob.sh "$jobDirectory" "$partialFile" "1"
echo "Resuming ..."
echo "$filename"
echo " "
fi
fi
done