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 | sourceRadio=
|
---|
29 | dateSelected=
|
---|
30 | typeofproc=
|
---|
31 | #first and last cycle to process
|
---|
32 | #
|
---|
33 | firstCycle=
|
---|
34 | lastCycle=
|
---|
35 | #use -sim option to simulate processing (debug the script as if...)
|
---|
36 | simulationMode=""
|
---|
37 | while [ $# -gt 0 ]
|
---|
38 | do
|
---|
39 | case "$1" in
|
---|
40 | -src) sourceRadio="$2"; shift;;
|
---|
41 | -date) dateSelected="-date $2"; dateJob="$2"; shift;;
|
---|
42 | -type) typeofproc="-type $2"; type=$2; shift;;
|
---|
43 | -fcycle) firstCycle="-fcycle $2"; fcycle="$2"; shift;;
|
---|
44 | -lcycle) lastCycle="-lcycle $2"; lcycle="$2"; shift;;
|
---|
45 | -sim)
|
---|
46 | simulationMode="-sim On"
|
---|
47 | $ECHO "INFO ${scriptName} running in SIMUL mode";;
|
---|
48 | -h)
|
---|
49 | echo >&2 \
|
---|
50 | "usage: $0 -src souce -date YYYYMMDD -type type [-fcycle firstCycle] [-lcycle lastCycle] [-sim to trig simulation mode]"
|
---|
51 | exit 1;;
|
---|
52 | *) break;; # terminate while loop
|
---|
53 | esac
|
---|
54 | shift
|
---|
55 | done
|
---|
56 |
|
---|
57 | if [ "<${sourceRadio}>" = "<>" ]; then
|
---|
58 | $ECHO "FATAL: You have forgotten to select the source option (-src)"
|
---|
59 | exit 1
|
---|
60 | fi
|
---|
61 |
|
---|
62 | if [ "<${dateSelected}>" = "<>" ]; then
|
---|
63 | $ECHO "FATAL: You have forgotten to select the date option (-date)"
|
---|
64 | exit 1
|
---|
65 | fi
|
---|
66 |
|
---|
67 | if [ "<${typeofproc}>" = "<>" ]; then
|
---|
68 | $ECHO "FATAL: You have forgotten to select the type option (-type)"
|
---|
69 | exit 1
|
---|
70 | fi
|
---|
71 |
|
---|
72 | #Path to public backupable path
|
---|
73 | publicpath="/afs/in2p3.fr/home/c/campagne/public"
|
---|
74 | #temporary files to synchronize scripts
|
---|
75 | tmppublicpath=${TMPPUBLICPATH}
|
---|
76 | #Path of the utility scripts
|
---|
77 | scriptpath="/afs/in2p3.fr/home/c/campagne/private/work/AmasNancay"
|
---|
78 | #get the daq current irod status
|
---|
79 | tag=`${DATE} +%F`
|
---|
80 | OUT1=${publicpath}/baodaqstatus-${tag}.txt
|
---|
81 |
|
---|
82 | if [ ! -e ${OUT1} -o ! -r ${OUT1} ]; then
|
---|
83 | $ECHO "We should bring the DAQ status more up to date, this take 1 or 2sec..."
|
---|
84 | $RM -f ${tmppublicpath}/statusdaq.finished
|
---|
85 | ${scriptpath}/statusdaq.sh > ${OUT1}
|
---|
86 | while [ ! -f "${tmppublicpath}/statusdaq.finished" ]; do
|
---|
87 | sleep 30
|
---|
88 | done
|
---|
89 | $RM ${tmppublicpath}/statusdaq.finished
|
---|
90 | #protect against remove/rewriting
|
---|
91 | $CHMOD -v 444 ${OUT1}
|
---|
92 | fi
|
---|
93 |
|
---|
94 | #assume 20 files/cycles cf. 30sec/cycle et 3sec par signal et fact 2 margin
|
---|
95 | if [ "<${firstCycle}>" != "<>" -a "<${lastCycle}>" != "<>" ]; then
|
---|
96 | jobBatchName="rawonoff-${sourceRadio}${dateJob}${type}-${fcycle}-${lcycle}"
|
---|
97 | nFiles=`expr ${lcycle} - ${fcycle} + 1`
|
---|
98 | nFiles=`expr ${nFiles} \* 20`
|
---|
99 | else
|
---|
100 | jobBatchName="rawonoff-${sourceRadio}${dateJob}${type}-All"
|
---|
101 | #assume 30 cycles maxi!
|
---|
102 | nFiles="20 \* 30"
|
---|
103 |
|
---|
104 | fi
|
---|
105 |
|
---|
106 | jobLogName="${jobBatchName}.log.$$"
|
---|
107 |
|
---|
108 | #Nbre de paquets utilises pour 1 spectre
|
---|
109 | tspwin="5120"
|
---|
110 | #calcul du scratch sachant que l'on nettoie apres chaque cycle
|
---|
111 | nSpectra=`expr 20 \* 25600 / ${tspwin}`
|
---|
112 | scratchSize=`expr 20 \* 500 + ${nSpectra} \* 200 / 1000 + 5`
|
---|
113 |
|
---|
114 | #le cpu total tient compte de l'emsemble des ficheirs a taiter
|
---|
115 | cpu=`expr ${nFiles} \* 60 \* 50`
|
---|
116 |
|
---|
117 | qsub -l u_sps_baoradio,u_irods,T=${cpu},M=1000MB,scratch=${scratchSize}MB,platform=LINUX -eo -o $jobLogName -N $jobBatchName -mb -me -mu campagne@lal.in2p3.fr <<EOF
|
---|
118 | /afs/in2p3.fr/home/c/campagne/private/work/AmasNancay/proc_rawonoff.sh -src ${sourceRadio} ${dateSelected} ${typeofproc} ${firstCycle} ${lastCycle} ${simulationMode}
|
---|
119 | EOF
|
---|