File indexing completed on 2024-04-06 12:23:19
0001
0002
0003 function DoO2O(){
0004 echo -n "$runString -- "
0005 if grep -q "$runString" $storeFile ; then
0006 echo O2O transfer already performed or not necessary
0007 else
0008
0009 if tail -n1 $storeFile | grep -qe "`echo $runString | cut -d":" -f 2-`" ; then
0010 echo Fed and partition not changed since last IOV was opened. O2O Not necessary
0011 echo "$runString -- Not Necessary" >> $storeFile
0012 elif [ 0`tail -n1 $storeFile | awk '{print $1}'` -gt $oldRunNb ]; then
0013 echo RunNumber $oldRunNb violates append mode. last uploaded run is `tail -n1 $storeFile | awk '{print $1}'`
0014 echo -e "\n Please, to include this run, start the o2o with a new offline tag name in file $basePath/`basename $0`\nCurrent tag is $Tag"
0015 echo -e "\n--- Run skipped ----\n"
0016 return
0017 else
0018 echo Performing O2O...
0019
0020 cp template_sistripo2o_multipartition.cfg $log/tmp.cfg
0021 counter=0
0022 echo $runString | sed -e "s@:Part:@\n@g" | awk '{ if(NR>1) print $0 }'| while read line;
0023 do
0024 vec=($line)
0025 partition=${vec[0]}
0026
0027
0028
0029
0030
0031 let counter++
0032
0033 cat $log/tmp.cfg | sed -e "s#insert_onlineDB#$onlineDB#g" -e "s@insert_Run@$oldRunNb@g" -e "s@insert_ConfigDbPartition_$counter@$partition@g" -e "s@insert_authPath@$authPath@" -e "s@insert_tag@$Tag@" -e "s@insert_connect_string@$connectString@" -e "s@#DO${oldPedmode}@@" -e "s@#thePart${counter}@@" -e "s@insert_logdb@$logdb@"> $log/tmp1.cfg
0034 mv $log/tmp1.cfg $log/tmp.cfg
0035 done
0036 cp $log/tmp.cfg $log/siStripO2O_$oldRunNb.cfg
0037 rm $log/tmp.cfg
0038
0039 if cmsRun $log/siStripO2O_$oldRunNb.cfg > $log/siStripO2O_$oldRunNb.log ; then
0040 if [ "$oldPedmode" == "PEDESTAL" ]; then
0041 echo "$runString -- CabPed">> $storeFile
0042 else
0043 echo "$runString -- CabOnly">> $storeFile
0044 fi
0045 else
0046 echo ERROR in O2O performing. EXIT!
0047 echo check log file `pwd`/$log/siStripO2O_$oldRunNb.log
0048 doExit="true"
0049 fi
0050 fi
0051 fi
0052 }
0053
0054
0055
0056
0057
0058
0059 cd `dirname $0`
0060 basePath=`pwd`
0061
0062 [ -e "LockFileComm" ] && echo -e "\n Lock File already exists. \nProbably a process is already running. \nOtherwise, please remove the lockFile from $basePath/LockFileComm" && exit
0063 LOCKFILE=`pwd`/LockFileComm
0064 ERRORLOCKFILE="/tmp/o2o-error-`date +%Y%m%d%H%M`"
0065 touch $LOCKFILE
0066 touch $ERRORLOCKFILE
0067 trap "rm -f $LOCKFILE" EXIT
0068
0069 source /nfshome0/cmssw2/scripts/setup.sh
0070 cd /raid/cmssw/Development/O2O/CMSSW_2_0_8/src/
0071 eval `scramv1 runtime -sh`
0072 cd $basePath
0073
0074 preTag=TKCC_20X
0075 postTag=Comm_v1
0076 Tag=${preTag}_${postTag}
0077 authPath=/nfshome0/xiezhen/conddb/
0078
0079 onlineDB="cms_trk_tkcc/tkcc2008@cms_omds_lb"
0080 connectString="oracle://cms_orcon_prod/CMS_COND_20X_STRIP"
0081
0082
0083
0084
0085 logdb="oracle://cms_orcon_prod/CMS_COND_21X_POPCONLOG"
0086 storeFile="/raid/cmssw/Development/O2O/store/doneRuns_${preTag}_${postTag}"
0087 doExit="false"
0088
0089 touch $storeFile
0090
0091 log=log_at_P5_$Tag
0092
0093 mkdir $log
0094
0095 export TNS_ADMIN=/nfshome0/xiezhen/conddb
0096
0097
0098
0099 oldRunNb=-1
0100 oldPedmode=blablabla
0101 runString=""
0102
0103 sqlplus -S -M "HTML ON " $onlineDB < OMDSQuery_multipartition.sql | awk 'BEGIN{newline=0; stringa=""} $0~/<*th.*>/{newline=0} $0~/<tr>/{newline=1;if(stringa!="") print stringa; stringa=""} $0~/<\/tr>/{newline=0;} $0!~/<?td.*>/{if(newline && $0!="<tr>"){stringa=sprintf("%s %s",stringa,$0)}} END{print "99999999999999 LATENCY"}' | sort -n| while read line;
0104 do
0105 vec=($line)
0106
0107
0108
0109
0110 runNb=${vec[0]}
0111 mode=${vec[1]}
0112 partition=${vec[2]}
0113 fecV=${vec[3]}
0114 fedV=${vec[4]}
0115 cabV=${vec[5]}
0116 dcuV=${vec[6]}
0117
0118 if [ "$mode" == "LATENCY" ] || [ "$mode" == "PHYSIC" ]; then
0119 runVer=":Part: $partition $cabV $fedV $dcuV"
0120 pedmode="PEDESTAL"
0121 continue
0122 elif [ "$mode" == "PEDESTAL" ]; then
0123 runVer=":Part: $partition $cabV XXX $dcuV"
0124 pedmode="blablabla"
0125 else
0126 continue
0127 fi
0128
0129 if [ "$oldRunNb" != "$runNb" ]; then
0130 if [ "$oldRunNb" != "-1" ]; then
0131
0132
0133 DoO2O
0134 fi
0135 runString="$runNb $mode"
0136 oldRunNb=$runNb
0137 oldPedmode=$pedmode
0138 fi
0139 runString="$runString $runVer"
0140
0141
0142 [[ "$doExit" != "false" ]] && break
0143
0144
0145 echo ""
0146
0147 done
0148
0149 echo ""
0150
0151 rm -f $LOCKFILE
0152 rm -f $ERRORLOCKFILE