1 |
buchmann |
1.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 |
fronga |
1.2 |
executable="./Selective_Plot_Generator_"$$".exec"
|
11 |
buchmann |
1.1 |
|
12 |
|
|
function set_savedir {
|
13 |
|
|
procstring=${1/\"/+}
|
14 |
|
|
procstring=${procstring/\"/+}
|
15 |
|
|
savedir=`echo "$procstring" | awk -F [++] '{print $2}'`
|
16 |
|
|
}
|
17 |
|
|
|
18 |
|
|
function is_it_real {
|
19 |
|
|
if [[ $2 == "string" ]]; then
|
20 |
|
|
set_savedir "$1"
|
21 |
|
|
fi
|
22 |
|
|
}
|
23 |
|
|
function submit {
|
24 |
|
|
while read line
|
25 |
|
|
do
|
26 |
|
|
if [[ $line == *directoryname* ]]; then
|
27 |
|
|
is_it_real "$line" $line
|
28 |
|
|
fi
|
29 |
|
|
done < Modules/Setup.C
|
30 |
|
|
currloc=`pwd`/
|
31 |
|
|
echo "Going to create the following directory (if it doesn't exit): `pwd`/Plots/$savedir/"
|
32 |
|
|
mkdir -p `pwd`/Plots/$savedir/
|
33 |
|
|
errloc=`pwd`/Plots/$savedir/Official_Log_errors.txt
|
34 |
|
|
logloc=`pwd`/Plots/$savedir/Official_Log.txt
|
35 |
|
|
thisscript=`basename $0`
|
36 |
|
|
cmd="qsub -e $errloc -o $logloc -q long.q -N aCBAF $thisscript $currloc"
|
37 |
|
|
eval $cmd
|
38 |
|
|
echo -e "Job has been sent in using the following command: \n $cmd"
|
39 |
|
|
}
|
40 |
|
|
function runjob {
|
41 |
|
|
source /swshare/ROOT/thisroot.sh
|
42 |
|
|
cd $location
|
43 |
fronga |
1.2 |
cp -v ./Selective_Plot_Generator.exec $executable
|
44 |
|
|
# $executable --region --kin
|
45 |
|
|
$executable --all --paper
|
46 |
|
|
rm -v $executable
|
47 |
buchmann |
1.1 |
}
|
48 |
|
|
|
49 |
|
|
compname=`hostname`
|
50 |
|
|
echo "You are calling this script from: $compname"
|
51 |
|
|
|
52 |
|
|
if [[ $compname == *t3ui* ]]; then
|
53 |
|
|
echo "We're on a user interface - going to submit jobs"
|
54 |
|
|
submit
|
55 |
|
|
else
|
56 |
|
|
if [[ $compname == *t3wn* ]]; then
|
57 |
|
|
echo "We're on a worker node - going to run this job"
|
58 |
|
|
location=$1
|
59 |
|
|
runjob
|
60 |
|
|
else
|
61 |
|
|
echo "We're neither on a user interface nor on a workernode. Confused. Leaving."
|
62 |
|
|
fi
|
63 |
fronga |
1.2 |
fi
|