ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/Development/Plotting/RunAnalysisOnWN.sh
Revision: 1.1
Committed: Thu Jun 7 13:15:17 2012 UTC (12 years, 11 months ago) by buchmann
Content type: application/x-sh
Branch: MAIN
Log Message:
Added script to run analysis on nodes

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     currloc=`pwd`/
30     echo "Going to create the following directory (if it doesn't exit): `pwd`/Plots/$savedir/"
31     mkdir -p `pwd`/Plots/$savedir/
32     errloc=`pwd`/Plots/$savedir/Official_Log_errors.txt
33     logloc=`pwd`/Plots/$savedir/Official_Log.txt
34     thisscript=`basename $0`
35     cmd="qsub -e $errloc -o $logloc -q long.q -N aCBAF $thisscript $currloc"
36     eval $cmd
37     echo -e "Job has been sent in using the following command: \n $cmd"
38     }
39     function runjob {
40     source /swshare/ROOT/thisroot.sh
41     cd $location
42     ./Selective_Plot_Generator.exec --all --paper
43     }
44    
45     compname=`hostname`
46     echo "You are calling this script from: $compname"
47    
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