#!/bin/ksh # # Script to run QA during production # # Usage: # # qasim_prod -r # # # # Author List: # Mehdi Benkebil Original Authors # Mossadek Talby # # Modifications: # A. Hasan Minor changes (8/April/98) # Jean-Louis Narjoux for running in batch at in2p3 1998/06/26 # # 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_sim export QAPRODSPACE QAWWWCHART=/afs/slac.stanford.edu/g/babar/doc/Computing/www/QA/QaSimTools/RunChart/MDC2 export QAWWWCHART # MGR_DIR=$BFROOT/QA/QaSimTools/mgr REFERENCE_DIR=$BFROOT/QA/QaSimTools/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 #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # 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/QaSimTools/sim_prod_exec/current RELEASE fi # [ -z "$EXE" ] && EXE=QaSimToolsApp [ -z "$EXEDIR" ] && EXEDIR=RELEASE/prod/$BFARCH staged=0 status=0 #runchart="y" # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # CLEAN UP ROUTINE : #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # cleanup() { /bin/rm -f QaSim* /bin/rm -f RELEASE prod_end_job persons_to_contact qasim.hbook core texput.log QaSim_ref.data /bin/rm -f QaSim_Results.database /bin/rm -f qasim_ref.hbook } # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # HELP MESSAGE #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # usage() { cat < ] e.g; qasim_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 QaSim 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 qasave.rzn ] ; then echo ERROR The qasave.rzn is not there cleanup exit 2 fi # /bin/ln -f -s qasave.rzn qasim.hbook # PGM=$EXEDIR/$EXE # if [ -s QaSim_v${rel}_${runnum}.log ] ; then echo move QaSim_v${rel}_${runnum}.log to QaSim_v${rel}_${runnum}.log.old /bin/mv QaSim_v${rel}_${runnum}.log QaSim_v${rel}_${runnum}.log.old fi # if [ -s QaSim.cards ] ; then /bin/rm -f QaSim.cards fi # # if [ $BFSITE = "ccin2p3" ] ; then njxphy=/afs/in2p3.fr/group/babar/narjoux/QA/QA672/060010/qasim_njx.phy njxint=./qasim_njx.file datatype=`$njxphy < $njxint` else datatype=`RELEASE/QaSimTools/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 runref=`fgrep "$datatype" ${MGR_DIR}/runlist_r${relcomp}.all | cut -c57,58,59,60,61,62` else runref=0 fi # if [ $BFSITE = "ccin2p3" ] ; then njxnev=/afs/in2p3.fr/group/babar/narjoux/QA/QA672/060010/qasim_njx.nev nevt=`$njxnev < $njxint` else nevt=`RELEASE/QaSimTools/nbrevt -b ${rel} ${runnum}` fi # if [ $? -ne 0 -o -f core ] ; then echo FAILED running nbrevt script cleanup exit 2 fi # writeref=n # cat > QaSim.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/QaSim_ref_r${relcomp}.data ] ; then echo WARNING: The ASCII reference file $REFERENCE_DIR/QaSim_ref_r${relcomp}.data does not exist touch QaSim_ref.data else /bin/ln -f -s $REFERENCE_DIR/QaSim_ref_r${relcomp}.data QaSim_ref.data fi # if [ ! -s $REFERENCE_DIR/QaSim_ref_r${relcomp}_${runref}.hbook ] ; then echo WARNING: The HBOOK reference file $REFERENCE_DIR/QaSim_ref_r${relcomp}_${runref}.hbook does not exist rhbookref=n else /bin/ln -f -s $REFERENCE_DIR/QaSim_ref_r${relcomp}_${runref}.hbook qasim_ref.hbook rhbookref=y fi # /bin/rm -f QaSim_Limits.data if [ ! -s $REFERENCE_DIR/QaSim_Limits_r${relcomp}.data ] ; then touch QaSim_Limits.data else /bin/ln -f -s $REFERENCE_DIR/QaSim_Limits_r${relcomp}.data QaSim_Limits.data fi # if [ $runchart = "y" ] ; then # if [ ! -s $QAPRODSPACE/QaSim_Results_r${rel}.database ] ; then touch QaSim_Results.database else /bin/ln -f -s $QAPRODSPACE/QaSim_Results_r${rel}.database QaSim_Results.database fi # fi # #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # SPECIFIC SECTION TO RUN QaSimTools package #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # echo echo '+-------------------------+' echo 'I Running QaSimTools I' echo '+-------------------------+' echo Start running $PGM at `date` and output is QaSim_r${rel}_${runnum}.log $PGM ${rel} ${runnum} ${sendtomgr} ${writeref} ${rhbookref} ${runchart}> QaSim_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 QaSim_ref.data # if [ ! -s QaSim_plots.ps ] ; then echo FAILED TO GENERATE QaSim_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 QaSim_plots.ps ] ; then echo FAILED TO GENERATE QaSim_summary.tex cleanup exit 2 fi # latex QaSim_summary.tex < /dev/null > /dev/null if [ ! -s QaSim_summary.dvi ] ; then echo FAILED TO RUN LATEX for file QaSim_summary.tex cleanup exit 2 fi dvips -o -t landscape QaSim_summary > /dev/null /bin/rm -rf QaSim_summary.dvi /bin/rm -rf QaSim_summary.log /bin/rm -rf QaSim_summary.aux # if [ ! -s QaSim_summary.ps ] ; then echo FAILED TO RUN DVIPS for file QaSim_summary.dvi cleanup exit 2 fi /bin/rm -rf QaSim_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 QaSim_plots.ps QaSim_plot_r${rel}_${runnum}.ps /bin/mv QaSim_summary.ps QaSim_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 #