ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/AnalysisFramework/Plotting/RunAnalysisOnWN.sh
Revision: 1.3
Committed: Wed Nov 30 10:48:40 2011 UTC (13 years, 5 months ago) by buchmann
Content type: application/x-sh
Branch: MAIN
CVS Tags: cbaf_4p7ifb
Changes since 1.2: +2 -1 lines
Log Message:
Creating plotting directory first in case it doesn't exist

File Contents

# User Rev Content
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    
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 buchmann 1.2 currloc=`pwd`/
30 buchmann 1.3 echo "Going to create the following directory (if it doesn't exit): `pwd`/Plots/$savedir/"
31 buchmann 1.2 mkdir -p `pwd`/Plots/$savedir/
32 buchmann 1.1 errloc=`pwd`/Plots/$savedir/Official_Log_errors.txt
33     logloc=`pwd`/Plots/$savedir/Official_Log.txt
34     thisscript=`basename $0`
35 buchmann 1.3 cmd="qsub -e $errloc -o $logloc -q all.q -N aCBAF $thisscript $currloc"
36 buchmann 1.1 eval $cmd
37 buchmann 1.2 echo -e "Job has been sent in using the following command: \n $cmd"
38 buchmann 1.1 }
39     function runjob {
40     source /swshare/ROOT/thisroot.sh
41     cd $location
42     ./Selective_Plot_Generator.exec --all
43     }
44    
45     compname=`hostname`
46 buchmann 1.2 echo "You are calling this script from: $compname"
47 buchmann 1.1
48     if [[ $compname == *t3ui* ]]; then
49     echo "We're on a user interface - going to submit jobs"
50     submit
51     else
52     if [[ $compname == *t3wn* ]]; then
53     echo "We're on a worker node - going to run this job"
54     location=$1
55     runjob
56     else
57     echo "We're neither on a user interface nor on a workernode. Confused. Leaving."
58     fi
59     fi