source: BAORadio/AmasNancay/trunk/submit2ge-procspecmfib.sh

Last change on this file was 635, checked in by campagne, 12 years ago

first introduction of DRIFT data (jec)

  • Property svn:executable set to *
File size: 3.7 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)
28#action: gain|mspec (gain: gain-like doucble median filtering
29#                   mspec: mean+sigma wo filetring)
30action="-act gain"
31sourceRadio=
32dateSelected=
33typeofproc=
34#first and last cycle to process
35#
36firstCycle=
37lastCycle=
38#use -sim option to simulate processing (debug the script as if...)
39simulationMode=""
40#drift scan option
41drift="No"
42while [ $# -gt 0 ]
43do
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
62done
63
64if [ "<${sourceRadio}>" = "<>" ]; then
65    $ECHO "FATAL: You have forgotten to select the source option (-src)"
66    exit 1
67fi
68
69if [ "<${dateSelected}>" = "<>" ]; then
70    $ECHO "FATAL: You have forgotten to select the date option (-date)"
71    exit 1
72fi
73
74if [ "<${typeofproc}>" = "<>" ]; then
75    $ECHO "FATAL: You have forgotten to select the type option (-type)"
76    exit 1
77fi
78
79#Path to public backupable path
80publicpath="/afs/in2p3.fr/home/c/campagne/public"
81#temporary files to synchronize scripts
82tmppublicpath=${TMPPUBLICPATH}
83#Path of the utility scripts
84scriptpath=${SCRIPTPATH}
85#get the daq current irod status
86#JEC 1/10/11 Use generic baodaqstatus name
87#### tag=`${DATE} +%F`
88OUT1=${publicpath}/baodaqstatus-current.txt
89
90if [ ! -e ${OUT1}  -o ! -r ${OUT1} ]; then
91    $ECHO "FATAL (${scriptName}): ${OUT1} has a problem"
92    exit 1
93fi
94
95#assume 2*10 files/cycles cf. 30sec/cycle et 3sec par signal et fact 2 margin
96# Test: assume for Abell1205, aout2011, 2*20 files
97if [ "<${type}>" = "<GAIN>" -o "<${type}>" = "<GAINDS>" ]; then
98    guessFiles=10
99elif [ "<$drift>" != "<Yes>" ]; then
100    guessFiles=40
101else
102    guessFiles=120
103fi
104
105if [ "<${firstCycle}>" != "<>" -a "<${lastCycle}>" != "<>" ]; then
106    jobBatchName="procspecmfib-${sourceRadio}${dateJob}${type}-${fcycle}-${lcycle}"
107    nFiles=`expr ${lcycle} - ${fcycle} + 1`
108    nFiles=`expr ${nFiles} \* ${guessFiles}`
109else
110    jobBatchName="procspecmfib-${sourceRadio}${dateJob}${type}-All"
111    #assume 20 cycles maxi!
112    nFiles=`expr ${guessFiles} \* 20`
113
114fi
115
116jobLogName="${jobBatchName}.log.$$"
117
118#Nbre de paquets utilises pour 1 spectre
119tspwin="5120"
120#calcul du scratch sachant que l'on nettoie apres chaque cycle
121nSpectra=`expr ${guessFiles} \* 25600 /  ${tspwin}`
122scratchSize=`expr  ${guessFiles} \* 500 + ${nSpectra} \* 200 / 1000 + 5`
123
124#le cpu total tient compte de l'emsemble des ficheirs a traiter
125#cpu=`expr ${nFiles} \* 60 \* 50`  # BQS estimation
126cpu=`expr ${nFiles} \* 60`
127
128qsub -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
129
130${SCRIPTPATH}/proc_specmfib.sh ${action} -src ${sourceRadio} ${dateSelected} ${typeofproc} ${firstCycle} ${lastCycle} ${simulationMode}
131EOF
Note: See TracBrowser for help on using the repository browser.