#!/bin/ksh # # Script to run QA during production # # Usage: # # qasimapp_prod -r # # # # Author List: # Mehdi Benkebil Original Authors # Mossadek Talby # # Modifications: # # 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_simapp export QAPRODSPACE QAWWWCHART=/afs/slac.stanford.edu/g/babar/doc/Computing/www/QA/QaSimAppTools/RunChart/MDC2 export QAWWWCHART # REFERENCE_DIR=$BFROOT/QA/QaSimAppTools/refdata MGR_DIR=$BFROOT/QA/QaSimAppTools/mgr # if [ -f core ] ; then echo A FILE NAMED core EXITS. ABORTING exit 3 fi # ### Set env variables if not already set # # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # SET THE VARAIBLES #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # if [ $BFSITE = "ccin2p3" ] ; then /bin/ln -f -s /afs/in2p3.fr/group/babar/narjoux/QA/QA672 RELEASE echo "RELEASE:" '/afs/in2p3.fr/group/babar/narjoux/QA/QA672' else /bin/rm -rf RELEASE /bin/ln -f -s /afs/slac.stanford.edu/g/babar/QA/QaSimAppTools/simapp_prod_exec/current RELEASE fi # [ -z "$EXE" ] && EXE=QaSimAppToolsApp [ -z "$EXEDIR" ] && EXEDIR=RELEASE/prod/$BFARCH staged=0 status=0 runchart="y" # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # CLEAN UP ROUTINE : #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # cleanup() { /bin/rm -f QaSimApp* /bin/rm -f RELEASE prod_end_job persons_to_contact qasimapp.hbook core texput.log QaSimApp_ref.data /bin/rm -f QaSimApp_Results.database /bin/rm -f qasimapp_ref.hbook } # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # HELP MESSAGE #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # usage() { cat < ] e.g; qasimapp_prod -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 QaSimApp Team And the package coordinator. The comparaison will be done with release 4.3.8a Mehdi Benkebil benkebil@slac.stanford.edu Mossadek Talby talby@slac.stanford.edu Jean-Louis Narjoux narjoux@in2p3.fr ######################################################################## 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 simappproduction.hbook ] ; then echo ERROR The simappproduction.hbook is not there cleanup exit 2 fi # /bin/ln -f -s simappproduction.hbook qasimapp.hbook # PGM=$EXEDIR/$EXE # if [ -s QaSimApp_v${rel}_${runnum}.log ] ; then echo move QaSimApp_v${rel}_${runnum}.log to QaSimApp_v${rel}_${runnum}.log.old /bin/mv QaSimApp_v${rel}_${runnum}.log QaSimApp_v${rel}_${runnum}.log.old fi # if [ -s QaSimApp.cards ] ; then /bin/rm -f QaSimApp.cards fi # # if [ $BFSITE = "ccin2p3" ] ; then njxphy=/afs/in2p3.fr/group/babar/narjoux/QA/QA672/060010/QaSimApp_njx.phy njxint=./QaSimApp_njx.file datatype=`$njxphy < $njxint` else datatype=`RELEASE/QaSimAppTools/dbtype ${runnum}` fi # if [ $? -ne 0 -o -f core ] ; then echo FAILED running dbtype script/"or"/njxphy 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 # if [ $BFSITE = "ccin2p3" ] ; then njxnev=/afs/in2p3.fr/group/babar/narjoux/QA/QA672/060010/QaSimApp_njx.nev nevt=`$njxnev < $njxint` else nevt=`RELEASE/QaSimAppTools/nbrevt -b ${rel} ${runnum}` fi # if [ $? -ne 0 -o -f core ] ; then echo FAILED running nbrevt script cleanup exit 2 fi # writeref=n # cat > QaSimApp.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/QaSimApp_ref_r${relcomp}.data ] ; then echo WARNING: The ASCII reference file $REFERENCE_DIR/QaSimApp_ref_r${relcomp}.data does not exist touch QaSimApp_ref.data else /bin/ln -f -s $REFERENCE_DIR/QaSimApp_ref_r${relcomp}.data QaSimApp_ref.data fi # if [ ! -s $REFERENCE_DIR/QaSimApp_ref_r${relcomp}_${runref}.hbook ] ; then echo WARNING: The HBOOK reference file $REFERENCE_DIR/QaSimApp_ref_r${relcomp}_${runref}.hbook does not exist rhbookref=n else /bin/ln -f -s $REFERENCE_DIR/QaSimApp_ref_r${relcomp}_${runref}.hbook qasimapp_ref.hbook rhbookref=y fi # /bin/rm -f QaSimApp_Limits.data if [ ! -s $REFERENCE_DIR/QaSimApp_Limits_r${relcomp}.data ] ; then touch QaSimApp_Limits.data else /bin/ln -f -s $REFERENCE_DIR/QaSimApp_Limits_r${relcomp}.data QaSimApp_Limits.data fi # if [ $runchart = "y" ] ; then # if [ ! -s $QAPRODSPACE/QaSimApp_Results_r${rel}.database ] ; then touch QaSimApp_Results.database else /bin/ln -f -s $QAPRODSPACE/QaSimApp_Results_r${rel}.database QaSimApp_Results.database fi # fi # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # SPECIFIC SECTION TO RUN QaSimAppTools package #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # echo echo '+-------------------------+' echo 'I Running QaSimAppTools I' echo '+-------------------------+' echo Start running $PGM at `date` and output is QaSimApp_r${rel}_${runnum}.log $PGM ${rel} ${runnum} ${sendtomgr} ${writeref} ${rhbookref} ${runchart}> QaSimApp_r${rel}_${runnum}.log if [ $? -gt 1 -o -f core ] ; then echo FAILED TO RUN $PGM cleanup exit 2 fi echo Completion at `date` /bin/rm -rf QaSimApp_ref.data # if [ ! -s QaSimApp_plots.ps ] ; then echo FAILED TO GENERATE QaSimApp_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 QaSimApp_plots.ps ] ; then echo FAILED TO GENERATE QaSimApp_summary.tex cleanup exit 2 fi # latex QaSimApp_summary.tex < /dev/null > /dev/null if [ ! -s QaSimApp_summary.dvi ] ; then echo FAILED TO RUN LATEX for file QaSimApp_summary.tex cleanup exit 2 fi dvips -o -t landscape QaSimApp_summary > /dev/null /bin/rm -rf QaSimApp_summary.dvi /bin/rm -rf QaSimApp_summary.log /bin/rm -rf QaSimApp_summary.aux # if [ ! -s QaSimApp_summary.ps ] ; then echo FAILED TO RUN DVIPS for file QaSimApp_summary.dvi cleanup exit 2 fi /bin/rm -rf QaSimApp_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 QaSimApp_plots.ps QaSimApp_plot_r${rel}_${runnum}.ps /bin/mv QaSimApp_summary.ps QaSimApp_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 #