[580] | 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 | while [ $# -gt 0 ] |
---|
| 41 | do |
---|
| 42 | case "$1" in |
---|
| 43 | -act) action="-act $2"; act=$2; shift;; |
---|
| 44 | -src) sourceRadio="$2"; shift;; |
---|
| 45 | -date) dateSelected="-date $2"; dateJob="$2"; shift;; |
---|
| 46 | -type) typeofproc="-type $2"; type=$2; shift;; |
---|
| 47 | -fcycle) firstCycle="-fcycle $2"; fcycle="$2"; shift;; |
---|
| 48 | -lcycle) lastCycle="-lcycle $2"; lcycle="$2"; shift;; |
---|
| 49 | -sim) |
---|
| 50 | simulationMode="-sim On" |
---|
| 51 | $ECHO "INFO ${scriptName} running in SIMUL mode";; |
---|
| 52 | -h) |
---|
| 53 | echo >&2 \ |
---|
[595] | 54 | "usage: $0 -src source -date YYYYMMDD -type type [-fcycle firstCycle] [-lcycle lastCycle] [-sim to trig simulation mode]" |
---|
[580] | 55 | exit 1;; |
---|
| 56 | *) break;; # terminate while loop |
---|
| 57 | esac |
---|
| 58 | shift |
---|
| 59 | done |
---|
| 60 | |
---|
| 61 | if [ "<${sourceRadio}>" = "<>" ]; then |
---|
| 62 | $ECHO "FATAL: You have forgotten to select the source option (-src)" |
---|
| 63 | exit 1 |
---|
| 64 | fi |
---|
| 65 | |
---|
| 66 | if [ "<${dateSelected}>" = "<>" ]; then |
---|
| 67 | $ECHO "FATAL: You have forgotten to select the date option (-date)" |
---|
| 68 | exit 1 |
---|
| 69 | fi |
---|
| 70 | |
---|
| 71 | if [ "<${typeofproc}>" = "<>" ]; then |
---|
| 72 | $ECHO "FATAL: You have forgotten to select the type option (-type)" |
---|
| 73 | exit 1 |
---|
| 74 | fi |
---|
| 75 | |
---|
| 76 | #Path to public backupable path |
---|
| 77 | publicpath="/afs/in2p3.fr/home/c/campagne/public" |
---|
| 78 | #temporary files to synchronize scripts |
---|
| 79 | tmppublicpath=${TMPPUBLICPATH} |
---|
| 80 | #Path of the utility scripts |
---|
| 81 | scriptpath=${SCRIPTPATH} |
---|
| 82 | #get the daq current irod status |
---|
| 83 | #JEC 1/10/11 Use generic baodaqstatus name |
---|
| 84 | #### tag=`${DATE} +%F` |
---|
| 85 | OUT1=${publicpath}/baodaqstatus-current.txt |
---|
| 86 | |
---|
| 87 | if [ ! -e ${OUT1} -o ! -r ${OUT1} ]; then |
---|
| 88 | $ECHO "FATAL (${scriptName}): ${OUT1} has a problem" |
---|
| 89 | exit 1 |
---|
| 90 | #JEC 29/9/11 avoid finished stuff |
---|
| 91 | # $RM -f ${tmppublicpath}/statusdaq.finished |
---|
| 92 | # ${scriptpath}/statusdaq.sh > ${OUT1} |
---|
| 93 | # while [ ! -f "${tmppublicpath}/statusdaq.finished" ]; do |
---|
| 94 | # sleep 30 |
---|
| 95 | # done |
---|
| 96 | # $RM ${tmppublicpath}/statusdaq.finished |
---|
| 97 | #protect against remove/rewriting |
---|
| 98 | # $CHMOD -v 444 ${OUT1} |
---|
| 99 | fi |
---|
| 100 | |
---|
[597] | 101 | #assume 2*10 files/cycles cf. 30sec/cycle et 3sec par signal et fact 2 margin |
---|
| 102 | # Test: assume for Abell1205, aout2011, 2*20 files |
---|
| 103 | guessFiles=40 |
---|
[580] | 104 | if [ "<${firstCycle}>" != "<>" -a "<${lastCycle}>" != "<>" ]; then |
---|
| 105 | jobBatchName="procspecmfib-${sourceRadio}${dateJob}${type}-${fcycle}-${lcycle}" |
---|
| 106 | nFiles=`expr ${lcycle} - ${fcycle} + 1` |
---|
[597] | 107 | nFiles=`expr ${nFiles} \* ${guessFiles}` |
---|
[580] | 108 | else |
---|
| 109 | jobBatchName="procspecmfib-${sourceRadio}${dateJob}${type}-All" |
---|
| 110 | #assume 30 cycles maxi! |
---|
[597] | 111 | nFiles=`expr ${guessFiles} \* 30` |
---|
[580] | 112 | |
---|
| 113 | fi |
---|
| 114 | |
---|
| 115 | jobLogName="${jobBatchName}.log.$$" |
---|
| 116 | |
---|
| 117 | #Nbre de paquets utilises pour 1 spectre |
---|
| 118 | tspwin="5120" |
---|
| 119 | #calcul du scratch sachant que l'on nettoie apres chaque cycle |
---|
[597] | 120 | nSpectra=`expr ${guessFiles} \* 25600 / ${tspwin}` |
---|
| 121 | scratchSize=`expr ${guessFiles} \* 500 + ${nSpectra} \* 200 / 1000 + 5` |
---|
[580] | 122 | |
---|
| 123 | #le cpu total tient compte de l'emsemble des ficheirs a traiter |
---|
| 124 | #cpu=`expr ${nFiles} \* 60 \* 50` # BQS estimation |
---|
| 125 | cpu=`expr ${nFiles} \* 60` |
---|
| 126 | |
---|
[598] | 127 | 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 |
---|
[580] | 128 | |
---|
| 129 | ${SCRIPTPATH}/proc_specmfib.sh ${action} -src ${sourceRadio} ${dateSelected} ${typeofproc} ${firstCycle} ${lastCycle} ${simulationMode} |
---|
| 130 | EOF |
---|