ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/AnalysisFramework/Plotting/RunAnalysisOnWN.sh
Revision: 1.2
Committed: Fri Nov 18 14:38:10 2011 UTC (13 years, 5 months ago) by buchmann
Content type: application/x-sh
Branch: MAIN
Changes since 1.1: +4 -3 lines
Log Message:
Minor change in worker node run script

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