#!/bin/ksh # # Script to run QA during production # # Usage: # # qarun -r # # # # Author List: # Mehdi Benkebil Original Authors # Mossadek Talby # # Copyright Information: # Copyright (C) 1998 Stanford Linear Accelerator Center (SLAC) # ######################################################################### # # ### Set env variables if not already set(May be site dependante) # QAPRODSPACE=$BFROOT/QA/prod_reco export QAPRODSPACE QAWWWCHART=/afs/slac.stanford.edu/g/babar/doc/Computing/www/QA/QaRecoTools/RunChart/MDC2 export QAWWWCHART # MGR_DIR=/afs/slac.stanford.edu/g/babar/QA/QaRecoTools/mgr REFERENCE_DIR=/afs/slac.stanford.edu/g/babar/QA/QaRecoTools/refdata # if [ -f core ] ; then echo A FILE NAMED core EXITS. ABORTING exit 3 fi # ### Set env variables if not already set # # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # SET THE VARAIBLES #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # /bin/rm -rf RELEASE /bin/ln -f -s /afs/slac.stanford.edu/g/babar/QA/QaRecoTools/reco_prod_exec/current RELEASE # [ -z "$EXE" ] && EXE=QaRecoToolsApp [ -z "$EXEDIR" ] && EXEDIR=RELEASE/prod/$BFARCH staged=0 status=0 runchart="y" # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # CLEAN UP ROUTINE : #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # cleanup() { /bin/rm -f QaReco* /bin/rm -f RELEASE prod_end_job persons_to_contact qareco.hbook core texput.log QaReco_ref.data qareco_ref.hbook /bin/rm -f QaReco_Results.database /bin/rm -f qareco_ref.hbook } # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # HELP MESSAGE #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # usage() { cat < ] e.g; qarun -r 4.3.9a 041617 4.3.8a y y execute run 041617 from release 4.3.9a In case of problems the mail will be send to QaReco Team And the package coordinator. The comparaison will be done with release 4.3.8a Mehdi Benkebil benkebil@slac.stanford.edu Mossadek Talby tably@slac.stanford.edu ######################################################################## EOF } # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # FILL THE OPTIONS #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # while [ ! -z "$1" ] ; do case "$1" in -h*) usage exit 0 ;; -r) shift; rel=$1 ; shift ;; -*) echo "FATAL: invalid option '$1'" usage exit 2 ;; *) runnum=$1 ; shift ; relcomp=$1; shift ; sendtomgr=$1 ; shift ; sendtopkg=$1 ; shift ;; esac done # # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # SETUP THE ENVIRONEMENT BEFORE run #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # if [ ! -s framework.hbook ] ; then echo ERROR The framework.hbook is not there cleanup exit 2 fi # /bin/ln -f -s framework.hbook qareco.hbook # PGM=$EXEDIR/$EXE # if [ -s QaReco_v${rel}_${runnum}.log ] ; then echo move QaReco_v${rel}_${runnum}.log to QaReco_v${rel}_${runnum}.log.old /bin/mv QaReco_v${rel}_${runnum}.log QaReco_v${rel}_${runnum}.log.old fi # if [ -s QaReco.cards ] ; then /bin/rm -f QaReco.cards fi # datatype=`RELEASE/QaRecoTools/dbtype ${runnum}` # if [ $? -ne 0 -o -f core ] ; then echo FAILED running dbtype script cleanup exit 2 fi # if [ -s ${MGR_DIR}/runlist_r${relcomp}.all ] ; then set -A ArrayRunref `fgrep "$datatype" ${MGR_DIR}/runlist_r${relcomp}.all | cut -c57,58,59,60,61,62` set -A ArrayType `fgrep "$datatype" ${MGR_DIR}/runlist_r${relcomp}.all | cut -c1-56` let nloop=0 let ntimes=0 runref=0 while (( $nloop < ${#ArrayRunref[*]} )); do Therun=${ArrayRunref[nloop]} TheType=`fgrep "$Therun" ${MGR_DIR}/runlist_r${relcomp}.all | cut -c1-56` typeset -Z56 v01=${TheType} typeset -Z56 v02=${datatype} typeset -L v1=${v01} typeset -L v2=${v02} if [[ $v1 == $v2 ]] ; then let ntimes=" ntimes + 1 " if (( $ntimes > 1 )) ; then echo ERROR: There is more than 1 run reference echo for the run number ${runnum} and type ${datatype} cleanup exit 2 fi runref=$Therun fi let nloop=" nloop + 1 " done else runref=0 fi # nevt=`RELEASE/QaRecoTools/nbrevt -r ${rel} ${runnum}` if [ $? -ne 0 -o -f core ] ; then echo FAILED running nbrevt script cleanup exit 2 fi # nevt=1000 # writeref=n # cat > QaReco.cards << END-OF-CARD rver ${rel} refe ${relcomp} runu ${runnum} fitg 1 wref ${writeref} nevt ${nevt} fili ${runnum} dtyp ${datatype} END-OF-CARD # # if [ ! -s $REFERENCE_DIR/QaReco_ref_r${relcomp}.data ] ; then echo WARNING: The ASCII reference file $REFERENCE_DIR/QaReco_ref_r${relcomp}.data does not exist touch QaReco_ref.data else /bin/ln -f -s $REFERENCE_DIR/QaReco_ref_r${relcomp}.data QaReco_ref.data fi # if [ ! -s $REFERENCE_DIR/QaReco_ref_r${relcomp}_${runref}.hbook ] ; then echo WARNING: The HBOOK reference file $REFERENCE_DIR/QaReco_ref_r${relcomp}_${runref}.hbook does not exist rhbookref=n else /bin/ln -f -s $REFERENCE_DIR/QaReco_ref_r${relcomp}_${runref}.hbook qareco_ref.hbook rhbookref=y fi # /bin/rm -f QaReco_Limits.data if [ ! -s $REFERENCE_DIR/QaReco_Limits_r${relcomp}.data ] ; then touch QaReco_Limits.data else /bin/ln -f -s $REFERENCE_DIR/QaReco_Limits_r${relcomp}.data QaReco_Limits.data fi # if [ $runchart = "y" ] ; then # if [ ! -s $QAPRODSPACE/QaReco_Results_r${rel}.database ] ; then touch QaReco_Results.database else /bin/ln -f -s $QAPRODSPACE/QaReco_Results_r${rel}.database QaReco_Results.database fi # fi # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # SPECIFIC SECTION TO RUN QaRecoTools package #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # echo echo '+-------------------------+' echo 'I Running QaRecoTools I' echo '+-------------------------+' echo Start running $PGM at `date` and output is QaReco_r${rel}_${runnum}.log $PGM ${rel} ${runnum} ${sendtomgr} ${writeref} ${rhbookref} ${runchart} > QaReco_r${rel}_${runnum}.log if [ $? -gt 1 -o -f core ] ; then echo FAILED TO RUN $PGM cleanup exit 2 fi echo Completion at `date` # if [ ! -s QaReco_plots.ps ] ; then echo FAILED TO GENERATE QaReco_plots.ps cleanup exit 2 fi # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # SPECIFIC SECTION TO PRODUCE THE POSTSCRIPT FILES #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # echo echo '+-----------------------------------------+' echo 'I Compiling the summary/comparison table I' echo '+-----------------------------------------+' # if [ ! -s QaReco_plots.ps ] ; then echo FAILED TO GENERATE QaReco_summary.tex cleanup exit 2 fi # latex QaReco_summary.tex < /dev/null > /dev/null if [ ! -s QaReco_summary.dvi ] ; then echo FAILED TO RUN LATEX for file QaReco_summary.tex cleanup exit 2 fi dvips -o -t landscape QaReco_summary > /dev/null /bin/rm -rf QaReco_summary.dvi /bin/rm -rf QaReco_summary.log /bin/rm -rf QaReco_summary.aux # if [ ! -s QaReco_summary.ps ] ; then echo FAILED TO RUN DVIPS for file QaReco_summary.dvi cleanup exit 2 fi /bin/rm -rf QaReco_summary.tex # # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # SPECIFIC SECTION TO SEND AUTOMATIC MAILS IN CASE OF WARNING #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # chmod u+rwx persons_to_contact # if [ $sendtopkg = "y" ] ; then echo echo '+-----------------------------------------+' echo 'I Sending warning to package coordinators I' echo '+-----------------------------------------+' persons_to_contact else echo echo '+---------------------------------------------+' echo 'I Do not send warning to package coordinators I' echo '+---------------------------------------------+' fi # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # RENAME POSTSCRIPT FILES #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # /bin/mv QaReco_plots.ps QaReco_plot_r${rel}_${runnum}.ps /bin/mv QaReco_summary.ps QaReco_summary_r${rel}_${runnum}.ps # # if [ $runchart = "y" ] ; then echo echo '+----------------------------------------------------+' echo 'I Converting the Run Chart to GIF FORMAT I' echo '+----------------------------------------------------+' # # dt1=`date | cut -f2 -d' '` dt2=`date | cut -f3 -d' '` dt3=`date | cut -f4 -d' '` # tmpdir=/tmp/chart${runnum}${rel}${relcomp}${dt1}${dt2}${dt3} home=`/bin/pwd` rm -rf ${tmpdir} mkdir ${tmpdir} mv QaChart*.ps ${tmpdir} mv QaDist*.ps ${tmpdir} cd ${tmpdir} # TMPCHART=${tmpdir} export TMPCHART # set -A filenames1 $(ls QaChart*.ps) let nmod=0 while (( $nmod < ${#filenames1[*]} )); do file=${filenames1[nmod]} echo Converting the file : $file ps2gif -color -24 -crop -border 5.0 -xdpi 82 -ydpi 82 $file > /dev/null let nmod=" nmod + 1 " done # set -A filenames2 $(ls QaDist*.ps) let nmod=0 while (( $nmod < ${#filenames2[*]} )); do file=${filenames2[nmod]} echo Converting the file : $file ps2gif -color -24 -crop -border 5.0 -xdpi 82 -ydpi 82 $file > /dev/null let nmod=" nmod + 1 " done cd ${home} fi # chmod u+rwx prod_end_job prod_end_job rm -rf ${tmpdir} cleanup exit $status #