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

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

cleaning of the set of scripts, and improve th submit2ge options, and improve analysis (jec)

  • Property svn:executable set to *
File size: 3.8 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=""
40while [ $# -gt 0 ]
41do
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 \
54            "usage: $0 -src source -date YYYYMMDD -type type [-fcycle firstCycle] [-lcycle lastCycle] [-sim to trig simulation mode]"
55        exit 1;;
56        *)  break;;     # terminate while loop
57    esac
58    shift
59done
60
61if [ "<${sourceRadio}>" = "<>" ]; then
62    $ECHO "FATAL: You have forgotten to select the source option (-src)"
63    exit 1
64fi
65
66if [ "<${dateSelected}>" = "<>" ]; then
67    $ECHO "FATAL: You have forgotten to select the date option (-date)"
68    exit 1
69fi
70
71if [ "<${typeofproc}>" = "<>" ]; then
72    $ECHO "FATAL: You have forgotten to select the type option (-type)"
73    exit 1
74fi
75
76#Path to public backupable path
77publicpath="/afs/in2p3.fr/home/c/campagne/public"
78#temporary files to synchronize scripts
79tmppublicpath=${TMPPUBLICPATH}
80#Path of the utility scripts
81scriptpath=${SCRIPTPATH}
82#get the daq current irod status
83#JEC 1/10/11 Use generic baodaqstatus name
84#### tag=`${DATE} +%F`
85OUT1=${publicpath}/baodaqstatus-current.txt
86
87if [ ! -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}
99fi
100
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
103guessFiles=40
104if [ "<${firstCycle}>" != "<>" -a "<${lastCycle}>" != "<>" ]; then
105    jobBatchName="procspecmfib-${sourceRadio}${dateJob}${type}-${fcycle}-${lcycle}"
106    nFiles=`expr ${lcycle} - ${fcycle} + 1`
107    nFiles=`expr ${nFiles} \* ${guessFiles}`
108else
109    jobBatchName="procspecmfib-${sourceRadio}${dateJob}${type}-All"
110    #assume 30 cycles maxi!
111    nFiles=`expr ${guessFiles} \* 30`
112
113fi
114
115jobLogName="${jobBatchName}.log.$$"
116
117#Nbre de paquets utilises pour 1 spectre
118tspwin="5120"
119#calcul du scratch sachant que l'on nettoie apres chaque cycle
120nSpectra=`expr ${guessFiles} \* 25600 /  ${tspwin}`
121scratchSize=`expr  ${guessFiles} \* 500 + ${nSpectra} \* 200 / 1000 + 5`
122
123#le cpu total tient compte de l'emsemble des ficheirs a traiter
124#cpu=`expr ${nFiles} \* 60 \* 50`  # BQS estimation
125cpu=`expr ${nFiles} \* 60`
126
127qsub -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
128
129${SCRIPTPATH}/proc_specmfib.sh ${action} -src ${sourceRadio} ${dateSelected} ${typeofproc} ${firstCycle} ${lastCycle} ${simulationMode}
130EOF
Note: See TracBrowser for help on using the repository browser.