source: BAORadio/AmasNancay/v2/submit2bqs-rawonoffmaker.sh@ 602

Last change on this file since 602 was 535, checked in by campagne, 14 years ago

nouvelle analyse sans calibration (jec)

  • Property svn:executable set to *
File size: 3.4 KB
Line 
1#!/bin/sh -xv
2AWK=/bin/awk
3SED=/bin/sed
4GREP=/bin/grep
5WC=/usr/bin/wc
6RM=/bin/rm
7CAT=/bin/cat
8TOUCH=/bin/touch
9DATE=/bin/date
10ECHO=/bin/echo
11LS=/bin/ls
12MKDIR=/bin/mkdir
13TR=/usr/bin/tr
14FIND=/usr/bin/find
15PRINTF=/usr/bin/printf
16XARGS=/usr/bin/xargs
17SORT=/bin/sort
18QSUB=qsub
19
20DefaultIFS=$' \t\n'
21IFS=$DefaultIFS
22
23
24scriptName="`basename $0`"
25echo "Processing script ${scriptName} at `date`"
26
27#Process cmd line args: the -src option is mandatory (source name as Abell85)
28sourceRadio=
29dateSelected=
30typeofproc=
31#first and last cycle to process
32#
33firstCycle=
34lastCycle=
35#use -sim option to simulate processing (debug the script as if...)
36simulationMode=""
37while [ $# -gt 0 ]
38do
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
55done
56
57if [ "<${sourceRadio}>" = "<>" ]; then
58 $ECHO "FATAL: You have forgotten to select the source option (-src)"
59 exit 1
60fi
61
62if [ "<${dateSelected}>" = "<>" ]; then
63 $ECHO "FATAL: You have forgotten to select the date option (-date)"
64 exit 1
65fi
66
67if [ "<${typeofproc}>" = "<>" ]; then
68 $ECHO "FATAL: You have forgotten to select the type option (-type)"
69 exit 1
70fi
71
72#Path to public backupable path
73publicpath="/afs/in2p3.fr/home/c/campagne/public"
74#temporary files to synchronize scripts
75tmppublicpath=${TMPPUBLICPATH}
76#Path of the utility scripts
77scriptpath="/afs/in2p3.fr/home/c/campagne/private/work/AmasNancay"
78#get the daq current irod status
79tag=`${DATE} +%F`
80OUT1=${publicpath}/baodaqstatus-${tag}.txt
81
82if [ ! -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}
92fi
93
94#assume 20 files/cycles cf. 30sec/cycle et 3sec par signal et fact 2 margin
95if [ "<${firstCycle}>" != "<>" -a "<${lastCycle}>" != "<>" ]; then
96 jobBatchName="rawonoff-${sourceRadio}${dateJob}${type}-${fcycle}-${lcycle}"
97 nFiles=`expr ${lcycle} - ${fcycle} + 1`
98 nFiles=`expr ${nFiles} \* 20`
99else
100 jobBatchName="rawonoff-${sourceRadio}${dateJob}${type}-All"
101 #assume 30 cycles maxi!
102 nFiles="20 \* 30"
103
104fi
105
106jobLogName="${jobBatchName}.log.$$"
107
108#Nbre de paquets utilises pour 1 spectre
109tspwin="5120"
110#calcul du scratch sachant que l'on nettoie apres chaque cycle
111nSpectra=`expr 20 \* 25600 / ${tspwin}`
112scratchSize=`expr 20 \* 500 + ${nSpectra} \* 200 / 1000 + 5`
113
114#le cpu total tient compte de l'emsemble des ficheirs a taiter
115cpu=`expr ${nFiles} \* 60 \* 50`
116
117qsub -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}
119EOF
Note: See TracBrowser for help on using the repository browser.