-
Notifications
You must be signed in to change notification settings - Fork 0
/
moveFailed.sh
56 lines (47 loc) · 1.66 KB
/
moveFailed.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
echo "Are you on longleaf?"
read answer
echo "Epsilon in filename? (y/n)"
read iseps
if [ $answer == 'y' ]; then
echo "Clusters are dope"
sedtype='sed'
elif [ $answer == 'n' ]; then
echo "Classic desktop... laptop?"
sedtype='gsed'
fi
mkdir "resubmits"
# Run from the directory where the slurm files are
if [ $iseps == "n" ]
then
for file in $(ls slurm-*)
do
count=$(grep -c "run complete" $file)
if [ $count -eq 1 ]; then
# Grab the python file that you need to resubmit
pa=$(grep -a -m 1 -h 'pa' $file | $sedtype 's/^.*pa\([0-9]*\)_.*/\1/')
pb=$(grep -a -m 1 -h '_pb' $file | $sedtype 's/^.*_pb\([0-9]*\)_.*/\1/')
xa=$(grep -a -m 1 -h '_xa' $file | $sedtype 's/^.*_xa\([0-9]*\)..*/\1/')
pyfile=pa${pa}_pb${pb}_xa${xa}.py
echo "Moving files... python: $pyfile slurm: $file"
mv $pyfile resubmits
rm $file
fi
done
else
for file in $(ls slurm-*)
do
count=$(grep -c "run complete" $file)
if [ $count -eq 1 ]; then
# Grab the python file that you need to resubmit
pa=$(grep -a -m 1 -h 'pa' $file | $sedtype 's/^.*pa\([0-9]*\)_.*/\1/')
pb=$(grep -a -m 1 -h '_pb' $file | $sedtype 's/^.*_pb\([0-9]*\)_.*/\1/')
xa=$(grep -a -m 1 -h '_xa' $file | $sedtype 's/^.*_xa\([0-9]*\)_.*/\1/')
ep=$(grep -a -m 1 -h '_eps' $file | $sedtype 's/^.*_eps\([0-9]*\)..*/\1/')
pyfile=pa${pa}_pb${pb}_xa${xa}_eps${ep}.py
echo "Moving python: $pyfile Removing slurm: $file"
mv $pyfile resubmits
rm $file
fi
done
fi