Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:48:28

0001 #!/bin/sh
0002 
0003 # L1Trigger O2O and WBM - validation, called by cron job
0004 
0005 pflag=0
0006 while getopts 'ph' OPTION
0007   do
0008   case $OPTION in
0009       p) pflag=1
0010           ;;
0011       h) echo "Usage: [-p]"
0012           echo "  -p: centrally installed release, not on local machine"
0013           exit
0014           ;;
0015   esac
0016 done
0017 shift $(($OPTIND - 1))
0018 
0019 #==============================================================================
0020 # Environment
0021 #==============================================================================
0022 
0023 release=CMSSW_4_2_3_ONLINE
0024 version=011
0025 
0026 #cd ~zrwan/CMSSW_3_11_0/cronjob
0027 cd /nfshome0/popcondev/L1Job/${release}/validate-o2o-wbm
0028 
0029 if [ ${pflag} -eq 0 ]
0030     then
0031     export SCRAM_ARCH=""
0032     export VO_CMS_SW_DIR=""
0033     source /opt/cmssw/cmsset_default.sh
0034 else
0035     source /nfshome0/cmssw2/scripts/setup.sh
0036     centralRel="-p"
0037 fi
0038 eval `scramv1 run -sh`
0039 
0040 #==============================================================================
0041 # Last file contains last run number and its validation status
0042 #==============================================================================
0043 
0044 #lastFile=last.txt
0045 lastFile=/nfshome0/popcondev/L1Job/${release}/validate-o2o-wbm/last.txt
0046 
0047 #==============================================================================
0048 # Summary file
0049 #==============================================================================
0050 
0051 #summaryFile=validate-o2o-wbm.summary
0052 summaryFile=/nfshome0/popcondev/L1Job/o2o.summary
0053 
0054 #==============================================================================
0055 # Log file
0056 #==============================================================================
0057 
0058 #logFile=validate-o2o-wbm.log
0059 logFile=/nfshome0/popcondev/L1Job/validate-o2o-wbm-${version}.log
0060 
0061 #==============================================================================
0062 # Last run number validated and its status are contained in the file last.txt.
0063 # If the validation was failed, the contents are e.g.
0064 # 132440 failed
0065 # Otherwise, the contents are e.g.
0066 # 132440 successful
0067 # Read in the last run number validated and its status. If the status was
0068 # successful, move forward. Otherwise, do nothing and exit, and when we
0069 # manually check the summary file and the log file, we will find out that we
0070 # have a problem to solve.
0071 #==============================================================================
0072 
0073 last=`cat ${lastFile}`
0074 
0075 lastRun=`echo ${last} | cut -f 1 -d ' '`
0076 lastStatus=`echo ${last} | cut -f 2 -d ' '`
0077 
0078 #if [ $lastStatus = "failed" ]
0079 #    then
0080 #    exit
0081 #fi
0082 
0083 #==============================================================================
0084 # In the case that last run number was validated as successful, we move
0085 # forward, look for the first of the next run number which has not been
0086 # validated yet.
0087 #==============================================================================
0088 
0089 #next=`~zrwan/CMSSW_3_11_0/cronjob/getNext.sh ${lastRun}`
0090 next=`$CMSSW_BASE/src/CondTools/L1Trigger/scripts/getNextO2OWBM.sh ${lastRun}`
0091 
0092 run=`echo ${next} | cut -f 1 -d ' '`
0093 
0094 if [ -z $run ]
0095     then
0096 #    echo "`date` : validate-o2o-wbm.sh" > ${summaryFile}
0097 #    echo "No new run to be validated" >> ${summaryFile}
0098     exit
0099 fi
0100 
0101 #==============================================================================
0102 # Up to this point, last run number was validated as successful, and there
0103 # is a new run number to be validated.
0104 #==============================================================================
0105 
0106 echo "`date` : validate-o2o-wbm.sh" >> ${logFile}
0107 echo "run = ${run}" >> ${logFile}
0108 echo "" >> ${logFile}
0109 
0110 #==============================================================================
0111 # O2O
0112 #==============================================================================
0113 
0114 cmsRun $CMSSW_BASE/src/CondTools/L1Trigger/test/l1o2otestanalyzer_cfg.py runNumber=${run} inputDBConnect=oracle://cms_orcon_prod/CMS_COND_31X_L1T inputDBAuth=/nfshome0/popcondev/conddb_taskWriters/L1T printL1TriggerKey=1 printRSKeys=1 >& o2o.log
0115 
0116 o2ocode=$?
0117 
0118 cat o2o.log >> ${logFile}
0119 echo "o2o status ${o2ocode}" >> ${logFile}
0120 echo "" >> ${logFile}
0121 
0122 #==============================================================================
0123 # WBM
0124 #==============================================================================
0125 
0126 $CMSSW_BASE/src/CondTools/L1Trigger/scripts/wbm.sh ${run} >& wbm.log
0127 
0128 wbmcode=$?
0129 
0130 cat wbm.log >> ${logFile}
0131 echo "wbm status ${wbmcode}" >> ${logFile}
0132 echo "" >> ${logFile}
0133 
0134 #==============================================================================
0135 # Compare o2o.log with wbm.log, output val.log
0136 #==============================================================================
0137 
0138 python $CMSSW_BASE/src/CondTools/L1Trigger/scripts/validate-o2o-wbm.py
0139 
0140 val=`cat val.log`
0141 valStatus=`echo ${val} | cut -f 1 -d ' '`
0142 valcode=0
0143 if [ $valStatus = "failed" ]
0144     then
0145     valcode=1
0146 fi
0147 
0148 echo "val status ${valcode}" >> ${logFile}
0149 echo "" >> ${logFile}
0150 
0151 #==============================================================================
0152 # Clean up and exit
0153 #==============================================================================
0154 
0155 rm -f o2o.log
0156 rm -f wbm.log
0157 rm -f val.log
0158 
0159 exitcode=`echo ${wbmcode} + ${o2ocode} + ${valcode} | bc`
0160 
0161 echo "run = ${run}" >> ${logFile}
0162 echo "wbm status ${wbmcode}" >> ${logFile}
0163 echo "o2o status ${o2ocode}" >> ${logFile}
0164 echo "val status ${valcode}" >> ${logFile}
0165 echo "exit code ${exitcode}" >> ${logFile}
0166 if [ ${exitcode} -eq 0 ]
0167     then
0168     echo "L1-O2O-WBM-INFO: successful" >> ${logFile}
0169 else
0170     echo "L1-O2O-WBM-INFO: failed" >> ${logFile}
0171 fi
0172 echo "`date` : validate-o2o-wbm.sh finished" >> ${logFile}
0173 echo "" >> ${logFile}
0174 
0175 tail -8 ${logFile} >> ${summaryFile}
0176 
0177 if [ ${exitcode} -eq 0 ]
0178     then
0179     echo "${run} successful" > ${lastFile}
0180     # standard output goes to email
0181 #    echo "${run} successful"
0182 else
0183     echo "${run} failed" > ${lastFile}
0184     # standard output goes to email
0185 #    echo "${run} failed"
0186 fi
0187 
0188 exit ${exitcode}