Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-24 22:29:58

0001 #!/bin/sh
0002 #set -x
0003 
0004 xflag=0
0005 CMS_OPTIONS=""
0006 KEY_CONTENT=""
0007 TAG_UPDATE=""
0008 UNSAFE=""
0009 
0010 while getopts 'xfk:t:u:d:h' OPTION
0011   do
0012   case $OPTION in
0013       x) xflag=1
0014           ;;
0015       f) CMS_OPTIONS=$CMS_OPTIONS" forceUpdate=1"
0016           ;;
0017       k) KEY_CONTENT=$KEY_CONTENT" subsystemLabels=$OPTARG"
0018           ;;
0019       t) if [ -z $TAG_UPDATE ] ; then TAG_UPDATE="tagUpdate="; else TAG_UPDATE=$TAG_UPDATE","; fi
0020          TAG_UPDATE=$TAG_UPDATE$OPTARG
0021           ;;
0022       u) if [ -z $UNSAFE ] ; then UNSAFE="unsafe="; else UNSAFE=$UNSAFE","; fi
0023          UNSAFE=$UNSAFE$OPTARG
0024          ;;
0025       d) if [ -z $DROPSYSTEMS ] ; then DROPSYSTEMS="dropFromJob="; else DROPSYSTEMS=$DROPSYSTEMS","; fi
0026          DROPSYSTEMS=$DROPSYSTEMS$OPTARG
0027          ;;
0028       h) echo "Usage: [-xf] runnum tsckey"
0029           echo "  -x: write to ORCON instead of sqlite file"
0030           echo "  -f: force IOV update"
0031           echo "  -k: limit update to the specific systems (default are all, which is equivalent to -k uGT,uGTrs,GMT,EMTF,OMTF,BMTF,CALO)"
0032           echo "  -t: override tag name as TYPE:NEW_TAG_BASE (e.g. -t L1TCaloParams:Stage2v1)"
0033           echo "  -u: lift transaction safety: carry on even problems are encountered (e.g. -u EMTF,OMTF,CALO)"
0034           echo "  -d: dron these systems form the job: Dont create WriterProxyT for these systems in the PayloadWriter Constructor (e.g. -d EMTF,OMTF,CALO)"
0035           exit
0036           ;;
0037   esac
0038 done
0039 shift $(($OPTIND - 1))
0040 
0041 runnum=$1
0042 tsckey=$2
0043 rskey=$3
0044 
0045 
0046 echo CMSSW_BASE = $CMSSW_BASE
0047 echo PWD = $PWD
0048 ls -a
0049 
0050 export TNS_ADMIN=/etc
0051 echo "INFO: ADDITIONAL CMS OPTIONS:  " $CMS_OPTIONS $KEY_CONTENT $TAG_UPDATE
0052 
0053 ONLINEDB_OPTIONS="onlineDBConnect=oracle://cms_omds_adg/CMS_TRG_R onlineDBAuth=$HOME/"
0054 PROTODB_OPTIONS="protoDBConnect=oracle://cms_orcon_adg/CMS_CONDITIONS protoDBAuth=$HOME/"
0055 
0056 ## test dir
0057 DATA_DIR=$CMSSW_BASE/$SCRAM_TEST_NAME
0058 mkdir $DATA_DIR
0059 ## get sqlite from the write-only CMSSW_SEARCH_PATH
0060 for dir in $(echo $CMSSW_SEARCH_PATH | tr ':' '\n') ; do
0061   [ -e $dir/L1TriggerConfig/L1TConfigProducers/data/l1config.db ] || continue
0062   cp $dir/L1TriggerConfig/L1TConfigProducers/data/l1config.db $DATA_DIR/
0063   break
0064 done
0065 local_db=$DATA_DIR/l1config.db
0066 sqlite3 $local_db -cmd "SELECT * from IOV;" ".q" > $DATA_DIR/iov_before
0067 
0068 echo "Writing to sqlite_file:$local_db instead of ORCON."
0069 INDB_OPTIONS="inputDBConnect=sqlite_file:$local_db inputDBAuth=$HOME/"
0070 OUTDB_OPTIONS="outputDBConnect=sqlite_file:$local_db outputDBAuth=$HOME/"
0071 COPY_OPTIONS="copyNonO2OPayloads=1 copyDBConnect=sqlite_file:$local_db"
0072 
0073 ##
0074 ## =============== O2O Job ===============
0075 ##
0076 
0077 L1TRIGGEREXT_DIR=${CMSSW_BASE}/src/CondTools/L1TriggerExt/test
0078 if [ ! -e ${L1TRIGGEREXT_DIR} ] ; then L1TRIGGEREXT_DIR=${CMSSW_RELEASE_BASE}/src/CondTools/L1TriggerExt/test ; fi
0079 if cmsRun -e ${L1TRIGGEREXT_DIR}/l1o2otestanalyzer_cfg.py ${INDB_OPTIONS} printL1TriggerKeyListExt=1 ${TAG_UPDATE} | c++filt --types | grep "${tsckey}:${rskey}" ; then echo "TSC payloads present"
0080 else
0081     echo "TSC payloads absent; writing $KEY_CONTENT now"
0082     cmsRun -e ${L1TRIGGEREXT_DIR}/L1ConfigWritePayloadOnlineExt_cfg.py tscKey=${tsckey} rsKey=${rskey} ${ONLINEDB_OPTIONS} ${PROTODB_OPTIONS} ${OUTDB_OPTIONS} ${COPY_OPTIONS} ${KEY_CONTENT} ${TAG_UPDATE} ${UNSAFE} ${DROPSYSTEMS} logTransactions=0 print | c++filt --types | tee -a lastLogForFM.txt
0083     #cmsRun ./L1ConfigWritePayloadOnlineExt_cfg.py tscKey=${tsckey} rsKey=${rskey} ${OUTDB_OPTIONS1} ${COPY_OPTIONS} ${KEY_CONTENT} ${TAG_UPDATE} ${UNSAFE} logTransactions=0 print | tee -a lastLogForFM.txt
0084     o2ocode=${PIPESTATUS[0]}
0085 #    o2ocode=$?
0086     if [ ${o2ocode} -ne 0 ]
0087     then
0088         echo "L1-O2O-ERROR: could not write TSC payloads"
0089         echo "L1-O2O-ERROR: could not write TSC payloads" 1>&2
0090         exit ${o2ocode}
0091     fi
0092 fi
0093 
0094 cmsRun ${L1TRIGGEREXT_DIR}/L1ConfigWriteIOVOnlineExt_cfg.py ${CMS_OPTIONS} tscKey=${tsckey} rsKey=${rskey} runNumber=${runnum} ${OUTDB_OPTIONS} ${TAG_UPDATE} logTransactions=0 print | grep -Ev "CORAL.*Info|CORAL.*Debug" | c++filt --types | tee -a lastLogForFM.txt
0095 o2ocode=${PIPESTATUS[0]}
0096 
0097 if [ ${o2ocode} -eq 0 ]
0098 then
0099     echo
0100     echo "`date` : checking O2O"
0101     if cmsRun ${L1TRIGGEREXT_DIR}/l1o2otestanalyzer_cfg.py ${INDB_OPTIONS} printL1TriggerKeyExt=1 runNumber=${runnum} ${TAG_UPDATE} | c++filt --types | grep ${tsckey} ; then echo "L1-O2O-INFO: IOV OK"
0102     else
0103         echo "L1-O2O-ERROR: IOV NOT OK"
0104         echo "L1-O2O-ERROR: IOV NOT OK" 1>&2
0105         exit 199
0106     fi
0107 else
0108     if [ ${o2ocode} -eq 66 ]
0109     then
0110         echo "L1-O2O-ERROR: unable to connect to OMDS or ORCON.  Check authentication token .cms_cond/db.key"
0111         echo "L1-O2O-ERROR: unable to connect to OMDS or ORCON.  Check authentication token .cms_cond/db.key" 1>&2
0112     else
0113         if [ ${o2ocode} -eq 65 ]
0114         then
0115             echo "L1-O2O-ERROR: problem writing object to ORCON."
0116             echo "L1-O2O-ERROR: problem writing object to ORCON." 1>&2
0117         fi
0118     fi
0119     exit ${o2ocode}
0120 fi
0121 
0122 echo ">>>>>>>"
0123 echo ">>>>>>> JOB REPORT"
0124 echo "============================== BEFORE O2O =============================="
0125 cat $DATA_DIR/iov_before
0126 echo "============================== AFTER O2O =============================="
0127 sqlite3 $local_db -cmd "SELECT * from IOV;" ".q"
0128 
0129 rm -r $DATA_DIR
0130 exit $o2ocode
0131