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

Last change on this file since 631 was 627, checked in by campagne, 13 years ago

correct case esac structure (jec)

  • Property svn:executable set to *
File size: 3.9 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
93#JEC 29/9/11 avoid finished stuff
94#    $RM -f ${tmppublicpath}/statusdaq.finished
95#    ${scriptpath}/statusdaq.sh > ${OUT1}
96#    while [ ! -f "${tmppublicpath}/statusdaq.finished" ]; do
97#       sleep 30
98#    done
99#    $RM ${tmppublicpath}/statusdaq.finished
100#protect against remove/rewriting   
101#    $CHMOD -v 444 ${OUT1}
102fi
103
104#assume 2*10 files/cycles cf. 30sec/cycle et 3sec par signal et fact 2 margin
105# Test: assume for Abell1205, aout2011, 2*20 files
106if [ "<$drift>" != "<Yes>" ]; then
107    guessFiles=40
108else
109    guessFiles=150
110fi
111
112if [ "<${firstCycle}>" != "<>" -a "<${lastCycle}>" != "<>" ]; then
113    jobBatchName="procspecmfib-${sourceRadio}${dateJob}${type}-${fcycle}-${lcycle}"
114    nFiles=`expr ${lcycle} - ${fcycle} + 1`
115    nFiles=`expr ${nFiles} \* ${guessFiles}`
116else
117    jobBatchName="procspecmfib-${sourceRadio}${dateJob}${type}-All"
118    #assume 30 cycles maxi!
119    nFiles=`expr ${guessFiles} \* 30`
120
121fi
122
123jobLogName="${jobBatchName}.log.$$"
124
125#Nbre de paquets utilises pour 1 spectre
126tspwin="5120"
127#calcul du scratch sachant que l'on nettoie apres chaque cycle
128nSpectra=`expr ${guessFiles} \* 25600 /  ${tspwin}`
129scratchSize=`expr  ${guessFiles} \* 500 + ${nSpectra} \* 200 / 1000 + 5`
130
131#le cpu total tient compte de l'emsemble des ficheirs a traiter
132#cpu=`expr ${nFiles} \* 60 \* 50`  # BQS estimation
133cpu=`expr ${nFiles} \* 60`
134
135qsub -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
136
137${SCRIPTPATH}/proc_specmfib.sh ${action} -src ${sourceRadio} ${dateSelected} ${typeofproc} ${firstCycle} ${lastCycle} ${simulationMode}
138EOF
Note: See TracBrowser for help on using the repository browser.