1 | #!/bin/sh -xvf |
---|
2 | #Basic tuning of system fuction used. |
---|
3 | AWK=/bin/awk |
---|
4 | SED=/bin/sed |
---|
5 | GREP=/bin/grep |
---|
6 | WC=/usr/bin/wc |
---|
7 | RM=/bin/rm |
---|
8 | CAT=/bin/cat |
---|
9 | TOUCH=/bin/touch |
---|
10 | DATE=/bin/date |
---|
11 | ECHO=/bin/echo |
---|
12 | LS=/bin/ls |
---|
13 | MKDIR=/bin/mkdir |
---|
14 | TR=/usr/bin/tr |
---|
15 | FIND=/usr/bin/find |
---|
16 | PRINTF=/usr/bin/printf |
---|
17 | XARGS=/usr/bin/xargs |
---|
18 | SORT=/bin/sort |
---|
19 | QSUB=qsub |
---|
20 | |
---|
21 | DefaultIFS=$' \t\n' |
---|
22 | IFS=$DefaultIFS |
---|
23 | |
---|
24 | |
---|
25 | scriptName="`basename $0`" |
---|
26 | $ECHO "Processing script ${scriptName} at `date`" |
---|
27 | ###### |
---|
28 | # Local functions |
---|
29 | ###### |
---|
30 | usage() { |
---|
31 | echo "usage: $scriptName <source> <YYYYMMDD-directory> <type of process>" |
---|
32 | echo " -<source> as Abell85" |
---|
33 | echo " -<YYYYMMDD-directory> as 20110428" |
---|
34 | echo " -<type of process> as GAIN|CALIBON|CALIBOFF|ON|OFF" |
---|
35 | } |
---|
36 | ###### |
---|
37 | # argument test |
---|
38 | ###### |
---|
39 | if [ ! $# = 3 ]; then |
---|
40 | usage |
---|
41 | touch proc_script.finished |
---|
42 | exit 1 |
---|
43 | fi |
---|
44 | sourceRadio=$1 |
---|
45 | srclower=`${ECHO} ${sourceRadio} | ${TR} "[:upper:]" "[:lower:]" ` |
---|
46 | dateDAQ=$2 |
---|
47 | typeofproc=$3 |
---|
48 | |
---|
49 | #Path to public backupable path |
---|
50 | publicpath="/afs/in2p3.fr/home/c/campagne/public" |
---|
51 | |
---|
52 | #temporary files to synchronize scripts |
---|
53 | tmppublicpath=${TMPPUBLICPATH} |
---|
54 | $LS -l ${tmppublicpath} > /dev/null |
---|
55 | |
---|
56 | |
---|
57 | #Path where the job will do temporary IO |
---|
58 | if [ ${ENVIRONMENT} = "INTERACTIVE" ]; then |
---|
59 | iojobpath="/sps/baoradio/AmasNancay/JEC" |
---|
60 | $MKDIR -p $iojobpath |
---|
61 | elif [ ${ENVIRONMENT} = "BATCH" ] ; then |
---|
62 | iojobpath=${TMPBATCH} |
---|
63 | else |
---|
64 | $ECHO "FATAL (${scriptName}): environment is ${ENVIRONMENT} not allowed" |
---|
65 | touch ${tmppublicpath}/proc_script.finished |
---|
66 | exit 1 |
---|
67 | fi |
---|
68 | cd ${iojobpath} |
---|
69 | |
---|
70 | localpath="${sourceRadio}/${dateDAQ}${srclower}" |
---|
71 | $MKDIR -p ./${localpath} |
---|
72 | cd ./${localpath} |
---|
73 | mainDirectory=`pwd` |
---|
74 | |
---|
75 | |
---|
76 | #Path of the utility scripts |
---|
77 | scriptpath=${SCRIPTPATH} |
---|
78 | |
---|
79 | |
---|
80 | #select file per cycle |
---|
81 | #$ECHO "Select files process..." |
---|
82 | #keep only lines with structure: cycle_number first,last,step |
---|
83 | #Get sca files |
---|
84 | $ECHO "DEBUG (${scriptName}): START call getscafiles.sh ${sourceRadio} ${dateDAQ}" |
---|
85 | OUT1=./getScaStatus.$$ |
---|
86 | $RM -f ${tmppublicpath}/getscafiles.finished |
---|
87 | ${scriptpath}/getscafiles.sh ${sourceRadio} ${dateDAQ} > ${OUT1} 2>&1 |
---|
88 | while [ ! -f "${tmppublicpath}/getscafiles.finished" ]; do |
---|
89 | $ECHO "INFO (${scriptName}): waiting for ${tmppublicpath}/getscafiles.finished" |
---|
90 | date +%T |
---|
91 | sleep 30 |
---|
92 | done |
---|
93 | $RM ${tmppublicpath}/getscafiles.finished |
---|
94 | $ECHO "DEBUG (${scriptName}): END" |
---|
95 | |
---|
96 | |
---|
97 | getScaStatus=`$GREP "^\(FATAL\|ERROR\)" ${OUT1}` |
---|
98 | |
---|
99 | if [ "<${getScaStatus}>" != "<>" ]; then |
---|
100 | $ECHO "FATAL (${scriptName}): error to get sca file for $sourceRadio $dateDAQ" |
---|
101 | $ECHO "DEBUG (${scriptName}): START with cat ${OUT1}" |
---|
102 | $CAT ${OUT1} |
---|
103 | $ECHO "DEBUG (${scriptName}): END" |
---|
104 | touch ${tmppublicpath}/proc_script.finished |
---|
105 | exit 1 |
---|
106 | fi |
---|
107 | |
---|
108 | |
---|
109 | scaFileSummarized=`$FIND . -name "sca*.sum" -print` |
---|
110 | if [ "<${scaFileSummarized}>" = "<>" ]; then |
---|
111 | $ECHO "FATAL (${scriptName}): strange sca file summarized not available: $sourceRadio $dateDAQ" |
---|
112 | $ECHO "DEBUG (${scriptName}): START with cat ${OUT1}" |
---|
113 | $CAT ${OUT1} |
---|
114 | $ECHO "DEBUG (${scriptName}): END" |
---|
115 | touch ${tmppublicpath}/proc_script.finished |
---|
116 | exit 1 |
---|
117 | fi |
---|
118 | $RM ${OUT1} |
---|
119 | |
---|
120 | scaFileSummarized=`basename $scaFileSummarized` |
---|
121 | |
---|
122 | #set Irods environment |
---|
123 | . /usr/local/shared/bin/irods_env.sh -noverbose |
---|
124 | #download header files to be used for signal files selction |
---|
125 | $MKDIR -p ./Fiber1 |
---|
126 | dirFiberfile=`pwd`/Fiber1 |
---|
127 | |
---|
128 | dirIrods="/baoradio/data/AmasNancay/${sourceRadio}/${dateDAQ}${srclower}/Fiber1" |
---|
129 | |
---|
130 | listOfFiles=( `ils ${dirIrods} | $GREP -i "header" | $XARGS -i basename {} | $SORT -k1.7n` ) |
---|
131 | IFS=' |
---|
132 | ' |
---|
133 | listOfFiles=( $( $PRINTF "%s\n" "${listOfFiles[@]}" | $AWK 'x[$0]++ == 0' ) ) |
---|
134 | IFS=$DefaultIFS |
---|
135 | |
---|
136 | # |
---|
137 | $ECHO "DEBUG (${scriptName}): Download if necessary the headers" |
---|
138 | # |
---|
139 | for ifile in ${listOfFiles[@]} |
---|
140 | do |
---|
141 | #test if the headers have not yet been downloaded |
---|
142 | if [ ! -e ${dirFiberfile}/${ifile} ]; then |
---|
143 | OUT2=./getheaders.$$ |
---|
144 | iget -f -K ${dirIrods}/${ifile} ${dirFiberfile} >${OUT2} 2>&1 |
---|
145 | igetStatus=`$GREP "^ERROR" ${OUT2}` |
---|
146 | if [ "<$igetStatus>" != "<>" ]; then |
---|
147 | $ECHO "FATAL (${scriptName}): error while iget:" |
---|
148 | $ECHO $igetStatus |
---|
149 | touch ${tmppublicpath}/proc_script.finished |
---|
150 | exit 1 |
---|
151 | fi |
---|
152 | $RM -f $OUT2 |
---|
153 | fi |
---|
154 | done |
---|
155 | # |
---|
156 | $ECHO "DEBUG (${scriptName}): START call select.sh ${scaFileSummarized} ${dirFiberfile} ${typeofproc}" |
---|
157 | # |
---|
158 | #Get list of file to process |
---|
159 | headerFileSelected=./selectSignal.$$ |
---|
160 | $RM -f ${tmppublicpath}/select.finished |
---|
161 | ${scriptpath}/select.sh ${scaFileSummarized} ${dirFiberfile} ${typeofproc} | $GREP "^#[0-9]" | $SED "s/^#//" > $headerFileSelected |
---|
162 | while [ ! -f "${tmppublicpath}/select.finished" ]; do |
---|
163 | $ECHO "INFO (${scriptName}): waiting for ${tmppublicpath}/select.finished" |
---|
164 | date +%T |
---|
165 | sleep 30 |
---|
166 | done |
---|
167 | $RM ${tmppublicpath}/select.finished |
---|
168 | # |
---|
169 | $ECHO "DEBUG (${scriptName}): END" |
---|
170 | # |
---|
171 | $ECHO "DEBUG (${scriptName}): START filling cycleArray, filesArray" |
---|
172 | # |
---|
173 | declare -a cycleArray |
---|
174 | declare -a filesArray |
---|
175 | $ECHO "DEBUG (${scriptName}): IFS value between<>: <$IFS>" |
---|
176 | IFS=$DefaultIFS |
---|
177 | $ECHO "DEBUG (${scriptName}): START cat $headerFileSelected" |
---|
178 | $CAT $headerFileSelected |
---|
179 | $ECHO "DEBUG (${scriptName}): END cat $headerFileSelected" |
---|
180 | |
---|
181 | while read v1 v2 |
---|
182 | do |
---|
183 | cycleArray[${#cycleArray[*]}]=$v1 |
---|
184 | filesArray[${#filesArray[*]}]=$v2 |
---|
185 | done < $headerFileSelected |
---|
186 | |
---|
187 | if [ ${#cycleArray[*]} -eq 0 -o ${#filesArray[*]} -eq 0 ]; then |
---|
188 | $ECHO "FATAL (${scriptName}): no header file selected (${#cycleArray[*]}, ${#filesArray[*]})" |
---|
189 | touch ${tmppublicpath}/proc_script.finished |
---|
190 | exit 1 |
---|
191 | else |
---|
192 | $ECHO "DEBUG (${scriptName}): non zero elements found for cycleArray and filesArray" |
---|
193 | fi |
---|
194 | |
---|
195 | # |
---|
196 | $ECHO "DEBUG (${scriptName}): number of elements <${#cycleArray[*]}> <${#filesArray[*]}>" |
---|
197 | $ECHO "DEBUG (${scriptName}): END" |
---|
198 | # |
---|
199 | # (timeShift) |
---|
200 | #Add 3sec to start ON / OFF |
---|
201 | #Substract 4sec to start DAB ON / OFF |
---|
202 | # |
---|
203 | #Take care: Cycle numbering starts at 1 in SCAFiles while Arrays index start at 0 |
---|
204 | # |
---|
205 | #for GAIN the reference cycle takes the middle of the run |
---|
206 | # |
---|
207 | #nwinmean donne le nombre de fenetre tspwin utilise pour faire calculer la moyenne des medianes de chaque fenetre |
---|
208 | #This is the nimber of paquets of the time window which change according to processing type |
---|
209 | $ECHO "DEBUG (${scriptName}): START switch on $typeofproc" |
---|
210 | # |
---|
211 | case "$typeofproc" in |
---|
212 | GAIN) |
---|
213 | $ECHO "process signal files for GAIN phase" |
---|
214 | ingain="" |
---|
215 | freqfilter="-freqfilter -" |
---|
216 | nwinmean="1" |
---|
217 | tspwin="5120" |
---|
218 | dirName="Off" |
---|
219 | cyclebasename="gaincycle" |
---|
220 | indexStartHour="6" |
---|
221 | timeShift="-4" |
---|
222 | timeDuration="14" |
---|
223 | firstCycleId=`expr ${#cycleArray[*]} / 2` |
---|
224 | firstCycleId=`expr ${firstCycleId} - 1` |
---|
225 | lastp1CycleId=`expr ${firstCycleId} + 1` |
---|
226 | ;; |
---|
227 | ON) |
---|
228 | $ECHO "process signal files for ON phases" |
---|
229 | ingain="-gain gain_${dateDAQ}_${srclower}.fits" |
---|
230 | freqfilter="-freqfilter 16" |
---|
231 | nwinmean="5" |
---|
232 | tspwin="5120" |
---|
233 | dirName="On" |
---|
234 | cyclebasename="datacycle" |
---|
235 | indexStartHour="4" |
---|
236 | timeShift="3" |
---|
237 | timeDuration="30" |
---|
238 | firstCycleId="0" |
---|
239 | lastp1CycleId="${#cycleArray[@]}" |
---|
240 | ;; |
---|
241 | OFF) |
---|
242 | $ECHO "process signal files for OFF phases" |
---|
243 | ingain="-gain gain_${dateDAQ}_${srclower}.fits" |
---|
244 | freqfilter="-freqfilter 16" |
---|
245 | nwinmean="5" |
---|
246 | tspwin="5120" |
---|
247 | dirName="Off" |
---|
248 | cyclebasename="datacycle" |
---|
249 | indexStartHour="8" |
---|
250 | timeShift="3" |
---|
251 | timeDuration="30" |
---|
252 | firstCycleId="0" |
---|
253 | lastp1CycleId="${#cycleArray[@]}" |
---|
254 | ;; |
---|
255 | CALIBON) |
---|
256 | $ECHO "process signal files for CALIBRATION ON phases" |
---|
257 | ingain="-gain gain_${dateDAQ}_${srclower}.fits" |
---|
258 | freqfilter="-freqfilter 16" |
---|
259 | nwinmean="1" |
---|
260 | tspwin="1024" |
---|
261 | dirName="On" |
---|
262 | cyclebasename="calibcycle" |
---|
263 | indexStartHour="2" |
---|
264 | timeShift="-4" |
---|
265 | timeDuration="14" |
---|
266 | firstCycleId="0" |
---|
267 | lastp1CycleId="${#cycleArray[@]}" |
---|
268 | ;; |
---|
269 | CALIBOFF) |
---|
270 | $ECHO "process signal files for CALIBRATION OFF phases" |
---|
271 | ingain="-gain gain_${dateDAQ}_${srclower}.fits" |
---|
272 | freqfilter="-freqfilter 16" |
---|
273 | nwinmean="1" |
---|
274 | tspwin="1024" |
---|
275 | dirName="Off" |
---|
276 | cyclebasename="calibcycle" |
---|
277 | indexStartHour="6" |
---|
278 | timeShift="-4" |
---|
279 | timeDuration="14" |
---|
280 | firstCycleId="0" |
---|
281 | lastp1CycleId="${#cycleArray[@]}" |
---|
282 | ;; |
---|
283 | *) |
---|
284 | $ECHO "FATAL (${scriptName}): type of processing" |
---|
285 | usage |
---|
286 | touch ${tmppublicpath}/proc_script.finished |
---|
287 | exit 1 |
---|
288 | ;; |
---|
289 | esac |
---|
290 | # |
---|
291 | $ECHO "DEBUG (${scriptName}): END" |
---|
292 | # |
---|
293 | # |
---|
294 | #Compute time windows (Warning usage of GMT date) |
---|
295 | # |
---|
296 | $ECHO "DEBUG (${scriptName}): START compute time windows" |
---|
297 | OUT=./baotiming.$$ |
---|
298 | ${AWK} -v datesys=${DATE} -v type=${indexStartHour} -v shift=${timeShift} ' |
---|
299 | BEGIN {FS=","} |
---|
300 | { |
---|
301 | phaseStart=$type |
---|
302 | cmd=sprintf("%s +%%s -d \"%s\" ",datesys,phaseStart); |
---|
303 | (cmd | getline phstart); |
---|
304 | close(cmd); |
---|
305 | newstart = phstart+shift; |
---|
306 | cmd=sprintf("%s +%%T -d \"1970-01-01 %s sec GMT\"",datesys,newstart); |
---|
307 | (cmd | getline newStart); |
---|
308 | close(cmd); |
---|
309 | print $1,newStart,phaseStart; |
---|
310 | } |
---|
311 | ' ${scaFileSummarized} > ${OUT} |
---|
312 | # |
---|
313 | $ECHO "DEBUG (${scriptName}): END" |
---|
314 | # |
---|
315 | $ECHO "DEBUG (${scriptName}): START cat ${OUT}" |
---|
316 | $CAT ${OUT} |
---|
317 | $ECHO "DEBUG (${scriptName}): END cat ${OUT}" |
---|
318 | # |
---|
319 | $ECHO "DEBUG (${scriptName}): START filling cylceArrayBis timeArray" |
---|
320 | # |
---|
321 | declare -a cycleArrayBis |
---|
322 | declare -a timeArray |
---|
323 | $ECHO "DEBUG (${scriptName}): IFS value between<>: <$IFS>" |
---|
324 | IFS=$DefaultIFS |
---|
325 | #select the selected cycles |
---|
326 | idtofind="0" |
---|
327 | while read v1 v2 v3 |
---|
328 | do |
---|
329 | if [ ${idtofind} -lt ${#cycleArray[*]} ]; then |
---|
330 | if [ ${v1} = ${cycleArray[${idtofind}]} ]; then |
---|
331 | cycleArrayBis[${#cycleArrayBis[*]}]=$v1 |
---|
332 | timeArray[${#timeArray[*]}]=$v2 |
---|
333 | idtofind=`expr ${idtofind} + 1` |
---|
334 | fi |
---|
335 | fi |
---|
336 | done < ${OUT} |
---|
337 | $ECHO "DEBUG (${scriptName}): number of elements ${#cycleArrayBis[*]} ${#timeArray[*]}" |
---|
338 | $ECHO "DEBUG (${scriptName}): END" |
---|
339 | |
---|
340 | |
---|
341 | ######################### |
---|
342 | # specmfib exe |
---|
343 | ######################### |
---|
344 | prg="/afs/in2p3.fr/throng/baoradio/Library/Progs/TAcq/Objs/specmfib" |
---|
345 | if [ ! -e $prg ]; then |
---|
346 | $ECHO "FATAL (${scriptName}): $prg not found" |
---|
347 | touch ${tmppublicpath}/proc_script.finished |
---|
348 | exit 1 |
---|
349 | fi |
---|
350 | |
---|
351 | |
---|
352 | dirFiberfile=${iojobpath}/${localpath} |
---|
353 | |
---|
354 | curDir=`pwd` |
---|
355 | # |
---|
356 | $ECHO "DEBUG (${scriptName}): in principle $dirFiberfile == $curDir " |
---|
357 | # |
---|
358 | #force single channel |
---|
359 | forceSingle="-singlechan" |
---|
360 | #debug |
---|
361 | prtlevel="1" |
---|
362 | |
---|
363 | |
---|
364 | #Loop on cycles to write batch script and send to batch queue |
---|
365 | ## |
---|
366 | $ECHO "DEBUG (${scriptName}): START loop on cycles ${firstCycleId} to ${lastp1CycleId}" |
---|
367 | |
---|
368 | for ((i=${firstCycleId};i<${lastp1CycleId};i++)); do |
---|
369 | # |
---|
370 | $ECHO "DEBUG (${scriptName}): process cycle $i" |
---|
371 | #time window selection |
---|
372 | tmproc="-tmproc ${timeArray[${i}]},${timeDuration}" |
---|
373 | #cycle <name><number> |
---|
374 | cycle="${cyclebasename}${cycleArray[${i}]}" |
---|
375 | #signal files selection |
---|
376 | infiles="${filesArray[${i}]}" |
---|
377 | # |
---|
378 | #Prepare BQS parameters: MEMORY, CPU...# |
---|
379 | infilesArray=( `$ECHO $infiles | $AWK 'BEGIN {FS=","} {for(i=1;i<NF;i++)print $i;}'` ) |
---|
380 | IFS=' |
---|
381 | ' |
---|
382 | infilesArray=( $( printf "%s\n" "${infilesArray[@]}" | awk 'x[$0]++ == 0' ) ) |
---|
383 | IFS=$DefaultIFS |
---|
384 | firstFile=${infilesArray[0]} |
---|
385 | lastFile=${infilesArray[1]} |
---|
386 | #compute Scratch Size MB (400MB per signal files), CPU Time |
---|
387 | nFiles=`expr ${lastFile} - ${firstFile} + 1` |
---|
388 | # Fiber 1 & Fiber 2 => double the number of files |
---|
389 | nFiles=`expr ${nFiles} \* 2` |
---|
390 | #add number of spectra generated (cf. (Nbrepaquets_per_files * nFiles /tspwin) * 100KB |
---|
391 | nSpectra=`expr ${nFiles} \* 25600 / ${tspwin}` |
---|
392 | #Guess formula to reserved the amount of space needed in scratch |
---|
393 | scratchSize=`expr ${nFiles} \* 500 + ${nSpectra} \* 200 / 1000 + 5` |
---|
394 | # 60sec/signal_file * empirical_conversion_factor (=50) |
---|
395 | cpu=`expr ${nFiles} \* 60 \* 50` |
---|
396 | #Virtual Memory (MB) Nb: at CCIN2P3 the reasonable max is 1GB |
---|
397 | virtualmem=1000 |
---|
398 | #Job and batch names |
---|
399 | jobBatchName="${sourceRadio}-${dateDAQ}-${typeofproc}-cycle${cycleArray[${i}]}" |
---|
400 | jobScriptName="${jobBatchName}.sh" |
---|
401 | jobLogName="${jobBatchName}.log" |
---|
402 | # |
---|
403 | $ECHO "DEBUG (${scriptName}): start writing ${jobScriptName}" |
---|
404 | # |
---|
405 | # |
---|
406 | #write the script to be send to Batch |
---|
407 | # |
---|
408 | $CAT > ${jobScriptName} <<EOF |
---|
409 | #!/bin/sh -xvf |
---|
410 | # jobBatchName=$jobBatchName |
---|
411 | # jobScriptName=$jobScriptName |
---|
412 | # jobLogName=$jobLogName |
---|
413 | scriptName=$jobScriptName |
---|
414 | |
---|
415 | . /afs/in2p3.fr/home/throng/baoradio/setup.sh |
---|
416 | . /usr/local/shared/bin/irods_env.sh -noverbose |
---|
417 | |
---|
418 | iojobpath=\${TMPBATCH} |
---|
419 | cd \${iojobpath} |
---|
420 | localpath=${sourceRadio}/${dateDAQ}${srclower} |
---|
421 | $MKDIR -p ./\${localpath} |
---|
422 | cd ./\${localpath} |
---|
423 | |
---|
424 | curDir=\`pwd\` |
---|
425 | #get gain file if necessary |
---|
426 | if [ ${typeofproc} != "GAIN" ]; then |
---|
427 | OUT2=./igetStatus.$$ |
---|
428 | iget /baoradio/data/AmasNancay/${localpath}/gain_${dateDAQ}_${srclower}.fits >\${OUT2} 2>&1 |
---|
429 | igetStatus=\`$GREP "^ERROR" \${OUT2}\` |
---|
430 | if [ "<\${igetStatus}>" != "<>" ]; then |
---|
431 | $ECHO "FATAL (\${scriptName}): error while iget:" |
---|
432 | $ECHO \$igetStatus |
---|
433 | touch ${tmppublicpath}/${jobBatchName}.finished |
---|
434 | exit 1 |
---|
435 | fi |
---|
436 | $RM \${OUT2} |
---|
437 | fi |
---|
438 | #get signals files |
---|
439 | OUT3=./getsignals.$$ |
---|
440 | $RM -f ${tmppublicpath}/getsignalfiles.finished |
---|
441 | ${scriptpath}/getsignalfiles.sh ${sourceRadio} ${dateDAQ} ${firstFile} ${lastFile} > \${OUT3} 2>&1 |
---|
442 | while [ ! -f "${tmppublicpath}/getsignalfiles.finished" ]; do |
---|
443 | $ECHO "INFO (\${scriptName}): waiting for ${tmppublicpath}/getsignalfiles.finished" |
---|
444 | date +%T |
---|
445 | sleep 30 |
---|
446 | done |
---|
447 | $RM ${tmppublicpath}/getsignalfiles.finished |
---|
448 | |
---|
449 | getSignals=\`$GREP "^FATAL" \${OUT3}\` |
---|
450 | if [ "<\$getSignals>" != "<>" ]; then |
---|
451 | $ECHO "FATAL (\${scriptName}): error while get signals" |
---|
452 | $ECHO \$getSignals |
---|
453 | touch ${tmppublicpath}/${jobBatchName}.finished |
---|
454 | exit 1 |
---|
455 | fi |
---|
456 | $RM \${OUT3} |
---|
457 | #location of the signal file |
---|
458 | fibfile="\${curDir} 1,2" |
---|
459 | # |
---|
460 | outDir=\${curDir}/${dirName}/${cycle} |
---|
461 | $MKDIR -p \${outDir} |
---|
462 | |
---|
463 | # |
---|
464 | # where ami... |
---|
465 | # |
---|
466 | $ECHO "We are here \`pwd\` to send the batch" |
---|
467 | $LS -lrth |
---|
468 | $FIND . -name "igetStatus.*" | $XARGS -i $CAT {} |
---|
469 | $LS ./Fiber1 | $WC -l |
---|
470 | $LS ./Fiber2 | $WC -l |
---|
471 | $LS -lR \${outDir} |
---|
472 | |
---|
473 | #Note: here act=gain means only that specmfib will use median-like algorithms (not only for gains...) |
---|
474 | $prg -act gain $forceSingle $freqfilter -prt $prtlevel -out \${outDir} -nmean $nwinmean $ingain $tmproc -tspwin ${tspwin},0,0 -in $infiles \${fibfile} |
---|
475 | |
---|
476 | $ECHO \${outDir} |
---|
477 | $LS -lrt \${outDir} |
---|
478 | |
---|
479 | #save results to Irods (use option -f ONLY to force override) |
---|
480 | iput -v -K -r \${curDir}/${dirName} /baoradio/data/AmasNancay/\${localpath} |
---|
481 | # |
---|
482 | #clean the signal files which can at the end of the day fill completly the scratch directory of the batch work/AmasNancayer |
---|
483 | $RM -f \${iojobpath}/\${localpath}/Fiber1/signal*.fits |
---|
484 | $RM -f \${iojobpath}/\${localpath}/Fiber2/signal*.fits |
---|
485 | touch ${tmppublicpath}/${jobBatchName}.finished |
---|
486 | exit 0 |
---|
487 | EOF |
---|
488 | # |
---|
489 | #The EOF tag MUST BEGIN the line, this is the end of the script |
---|
490 | # |
---|
491 | $ECHO "DEBUG (${scriptName}); START listing of script to be send to batch queue" |
---|
492 | $CAT -v ${jobScriptName} |
---|
493 | $ECHO "DEBUG (${scriptName}): END listing" |
---|
494 | # |
---|
495 | #send to BATCH |
---|
496 | # |
---|
497 | $ECHO "DEBUG (${scriptName}): START send to batch listing" |
---|
498 | # |
---|
499 | $RM -f ${tmppublicpath}/${jobBatchName}.finished |
---|
500 | |
---|
501 | ##26/9/11 JEC use option -h to trig manualy the job on the queue... |
---|
502 | qsub -h -l u_sps_baoradio,u_irods,u_irods_baoradio,T=${cpu},M=${virtualmem}MB,scratch=${scratchSize}MB,platform=LINUX -eo -o ${tmppublicpath}/${jobLogName} -N ${jobBatchName} ${jobScriptName} |
---|
503 | |
---|
504 | # while [ ! -f "${tmppublicpath}/${jobBatchName}.finished" ]; do |
---|
505 | # $ECHO "INFO (${scriptName}); waiting for ${tmppublicpath}/${jobBatchName}.finished" |
---|
506 | # date +%T |
---|
507 | # sleep 600 |
---|
508 | # done |
---|
509 | # $RM ${tmppublicpath}/${jobBatchName}.finished |
---|
510 | $ECHO "DEBUG (${scriptName}): end send to batch listing" |
---|
511 | #end loop on cycles |
---|
512 | done |
---|
513 | # |
---|
514 | $ECHO "DEBUG (${scriptName}): END loop on cycles" |
---|
515 | # |
---|
516 | touch ${tmppublicpath}/proc_script.finished |
---|
517 | exit 0 |
---|