1 |
#!/bin/bash
|
2 |
#
|
3 |
# This script will basically do the whole analysis workflow for you on a worker node.
|
4 |
# the huge advantage is that you can send this script to a worker node and hop on the
|
5 |
# train, not having to worry that your internet connection might break down :-)
|
6 |
#
|
7 |
|
8 |
savedir="standard"
|
9 |
location=`pwd`
|
10 |
|
11 |
function set_savedir {
|
12 |
procstring=${1/\"/+}
|
13 |
procstring=${procstring/\"/+}
|
14 |
savedir=`echo "$procstring" | awk -F [++] '{print $2}'`
|
15 |
}
|
16 |
|
17 |
function is_it_real {
|
18 |
if [[ $2 == "string" ]]; then
|
19 |
set_savedir "$1"
|
20 |
fi
|
21 |
}
|
22 |
function submit {
|
23 |
while read line
|
24 |
do
|
25 |
if [[ $line == *directoryname* ]]; then
|
26 |
is_it_real "$line" $line
|
27 |
fi
|
28 |
done < Modules/Setup.C
|
29 |
currloc=`pwd`
|
30 |
errloc=`pwd`/Plots/$savedir/Official_Log_errors.txt
|
31 |
logloc=`pwd`/Plots/$savedir/Official_Log.txt
|
32 |
thisscript=`basename $0`
|
33 |
cmd="qsub -e $errloc -o $logloc -N aCBAF $thisscript $currloc"
|
34 |
eval $cmd
|
35 |
echo "Job has been sent in"
|
36 |
}
|
37 |
function runjob {
|
38 |
source /swshare/ROOT/thisroot.sh
|
39 |
cd $location
|
40 |
./Selective_Plot_Generator.exec --all
|
41 |
}
|
42 |
|
43 |
compname=`hostname`
|
44 |
echo "You are calilng this script from: $compname"
|
45 |
|
46 |
if [[ $compname == *t3ui* ]]; then
|
47 |
echo "We're on a user interface - going to submit jobs"
|
48 |
submit
|
49 |
else
|
50 |
if [[ $compname == *t3wn* ]]; then
|
51 |
echo "We're on a worker node - going to run this job"
|
52 |
location=$1
|
53 |
runjob
|
54 |
else
|
55 |
echo "We're neither on a user interface nor on a workernode. Confused. Leaving."
|
56 |
fi
|
57 |
fi |