ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/Development/Plotting/RunAnalysisOnWN.sh
Revision: 1.3
Committed: Thu Aug 23 16:26:20 2012 UTC (12 years, 8 months ago) by fronga
Content type: application/x-sh
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +3 -2 lines
Log Message:
Give the job a more explicit name.

File Contents

# Content
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 executable="./Selective_Plot_Generator_"$$".exec"
11
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 short.q -N $savedir $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 cp -v ./Selective_Plot_Generator.exec $executable
44 # $executable --region --kin --pred --jzb --results
45 #$executable --kin --jzb --ttbar
46 $executable --all --paper
47 rm -v $executable
48 }
49
50 compname=`hostname`
51 echo "You are calling this script from: $compname"
52
53 if [[ $compname == *t3ui* ]]; then
54 echo "We're on a user interface - going to submit jobs"
55 submit
56 else
57 if [[ $compname == *t3wn* ]]; then
58 echo "We're on a worker node - going to run this job"
59 location=$1
60 runjob
61 else
62 echo "We're neither on a user interface nor on a workernode. Confused. Leaving."
63 fi
64 fi