1 | #!/bin/sh -xv |
---|
2 | AWK=/bin/awk |
---|
3 | SED=/bin/sed |
---|
4 | GREP=/bin/grep |
---|
5 | WC=/usr/bin/wc |
---|
6 | RM=/bin/rm |
---|
7 | CAT=/bin/cat |
---|
8 | TOUCH=/bin/touch |
---|
9 | DATE=/bin/date |
---|
10 | ECHO=/bin/echo |
---|
11 | LS=/bin/ls |
---|
12 | MKDIR=/bin/mkdir |
---|
13 | TR=/usr/bin/tr |
---|
14 | FIND=/usr/bin/find |
---|
15 | PRINTF=/usr/bin/printf |
---|
16 | XARGS=/usr/bin/xargs |
---|
17 | SORT=/bin/sort |
---|
18 | QSUB=qsub |
---|
19 | |
---|
20 | DefaultIFS=$' \t\n' |
---|
21 | IFS=$DefaultIFS |
---|
22 | |
---|
23 | |
---|
24 | scriptName="`basename $0`" |
---|
25 | echo "Processing script ${scriptName} at `date`" |
---|
26 | |
---|
27 | #Process cmd line args: the -src option is mandatory (source name as Abell85) |
---|
28 | #action: gain|mspec (gain: gain-like doucble median filtering |
---|
29 | # mspec: mean+sigma wo filetring) |
---|
30 | action="-act gain" |
---|
31 | sourceRadio= |
---|
32 | dateSelected= |
---|
33 | typeofproc= |
---|
34 | #first and last cycle to process |
---|
35 | # |
---|
36 | firstCycle= |
---|
37 | lastCycle= |
---|
38 | #use -sim option to simulate processing (debug the script as if...) |
---|
39 | simulationMode="" |
---|
40 | #drift scan option |
---|
41 | drift="No" |
---|
42 | while [ $# -gt 0 ] |
---|
43 | do |
---|
44 | case "$1" in |
---|
45 | -act) action="-act $2"; act=$2; shift;; |
---|
46 | -src) sourceRadio="$2"; shift;; |
---|
47 | -date) dateSelected="-date $2"; dateJob="$2"; shift;; |
---|
48 | -type) typeofproc="-type $2"; type=$2; shift;; |
---|
49 | -fcycle) firstCycle="-fcycle $2"; fcycle="$2"; shift;; |
---|
50 | -lcycle) lastCycle="-lcycle $2"; lcycle="$2"; shift;; |
---|
51 | -drift) drift="Yes";; |
---|
52 | -sim) |
---|
53 | simulationMode="-sim On" |
---|
54 | $ECHO "INFO ${scriptName} running in SIMUL mode";; |
---|
55 | -h) |
---|
56 | echo >&2 \ |
---|
57 | "usage: $0 -src source -date YYYYMMDD -type type [-fcycle firstCycle] [-lcycle lastCycle] [-sim to trig simulation mode]" |
---|
58 | exit 1;; |
---|
59 | *) break;; # terminate while loop |
---|
60 | esac |
---|
61 | shift |
---|
62 | done |
---|
63 | |
---|
64 | if [ "<${sourceRadio}>" = "<>" ]; then |
---|
65 | $ECHO "FATAL: You have forgotten to select the source option (-src)" |
---|
66 | exit 1 |
---|
67 | fi |
---|
68 | |
---|
69 | if [ "<${dateSelected}>" = "<>" ]; then |
---|
70 | $ECHO "FATAL: You have forgotten to select the date option (-date)" |
---|
71 | exit 1 |
---|
72 | fi |
---|
73 | |
---|
74 | if [ "<${typeofproc}>" = "<>" ]; then |
---|
75 | $ECHO "FATAL: You have forgotten to select the type option (-type)" |
---|
76 | exit 1 |
---|
77 | fi |
---|
78 | |
---|
79 | #Path to public backupable path |
---|
80 | publicpath="/afs/in2p3.fr/home/c/campagne/public" |
---|
81 | #temporary files to synchronize scripts |
---|
82 | tmppublicpath=${TMPPUBLICPATH} |
---|
83 | #Path of the utility scripts |
---|
84 | scriptpath=${SCRIPTPATH} |
---|
85 | #get the daq current irod status |
---|
86 | #JEC 1/10/11 Use generic baodaqstatus name |
---|
87 | #### tag=`${DATE} +%F` |
---|
88 | OUT1=${publicpath}/baodaqstatus-current.txt |
---|
89 | |
---|
90 | if [ ! -e ${OUT1} -o ! -r ${OUT1} ]; then |
---|
91 | $ECHO "FATAL (${scriptName}): ${OUT1} has a problem" |
---|
92 | exit 1 |
---|
93 | #JEC 29/9/11 avoid finished stuff |
---|
94 | # $RM -f ${tmppublicpath}/statusdaq.finished |
---|
95 | # ${scriptpath}/statusdaq.sh > ${OUT1} |
---|
96 | # while [ ! -f "${tmppublicpath}/statusdaq.finished" ]; do |
---|
97 | # sleep 30 |
---|
98 | # done |
---|
99 | # $RM ${tmppublicpath}/statusdaq.finished |
---|
100 | #protect against remove/rewriting |
---|
101 | # $CHMOD -v 444 ${OUT1} |
---|
102 | fi |
---|
103 | |
---|
104 | #assume 2*10 files/cycles cf. 30sec/cycle et 3sec par signal et fact 2 margin |
---|
105 | # Test: assume for Abell1205, aout2011, 2*20 files |
---|
106 | if [ "<$drift>" != "<Yes>" ]; then |
---|
107 | guessFiles=40 |
---|
108 | else |
---|
109 | guessFiles=150 |
---|
110 | fi |
---|
111 | |
---|
112 | if [ "<${firstCycle}>" != "<>" -a "<${lastCycle}>" != "<>" ]; then |
---|
113 | jobBatchName="procspecmfib-${sourceRadio}${dateJob}${type}-${fcycle}-${lcycle}" |
---|
114 | nFiles=`expr ${lcycle} - ${fcycle} + 1` |
---|
115 | nFiles=`expr ${nFiles} \* ${guessFiles}` |
---|
116 | else |
---|
117 | jobBatchName="procspecmfib-${sourceRadio}${dateJob}${type}-All" |
---|
118 | #assume 30 cycles maxi! |
---|
119 | nFiles=`expr ${guessFiles} \* 30` |
---|
120 | |
---|
121 | fi |
---|
122 | |
---|
123 | jobLogName="${jobBatchName}.log.$$" |
---|
124 | |
---|
125 | #Nbre de paquets utilises pour 1 spectre |
---|
126 | tspwin="5120" |
---|
127 | #calcul du scratch sachant que l'on nettoie apres chaque cycle |
---|
128 | nSpectra=`expr ${guessFiles} \* 25600 / ${tspwin}` |
---|
129 | scratchSize=`expr ${guessFiles} \* 500 + ${nSpectra} \* 200 / 1000 + 5` |
---|
130 | |
---|
131 | #le cpu total tient compte de l'emsemble des ficheirs a traiter |
---|
132 | #cpu=`expr ${nFiles} \* 60 \* 50` # BQS estimation |
---|
133 | cpu=`expr ${nFiles} \* 60` |
---|
134 | |
---|
135 | qsub -P P_baoradio -l sps=1,irods=1,ct=${cpu},vmem=1000M,fsize=${scratchSize}M -o ${PWD}/${jobLogName} -j yes -N $jobBatchName -m be -M ${LOGNAME}@lal.in2p3.fr -V <<EOF |
---|
136 | |
---|
137 | ${SCRIPTPATH}/proc_specmfib.sh ${action} -src ${sourceRadio} ${dateSelected} ${typeofproc} ${firstCycle} ${lastCycle} ${simulationMode} |
---|
138 | EOF |
---|