Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:23:19

0001 #!/bin/bash
0002 
0003 cd `dirname $0`
0004 basePath=`pwd`
0005 echo basePath $basePath
0006 
0007 source /nfshome0/cmssw2/scripts/setup.sh
0008 cd /raid/cmssw/Development/O2O/CMSSW_2_1_0_pre3/src/
0009 eval `scramv1 runtime -sh`
0010 cd $basePath
0011 
0012 preTag=TKCC_21X
0013 postTag=test8
0014 Tag=${preTag}_${postTag}
0015 authPath=/nfshome0/xiezhen/conddb/
0016 #authPath=/afs/cern.ch/cms/DB/conddb
0017 onlineDB="cms_trk_tkcc/tkcc2008@cms_omds_lb"
0018 connectString="oracle://cms_orcon_prod/CMS_COND_21X_STRIP"
0019 #connectString="oracle://cms_orcoff_int2r/CMS_COND_STRIP"
0020 #connectString="sqlite_file:dbfile.db"
0021 #logdb="sqlite_file:log.db"
0022 logdb="oracle://omds/CMS_POP_CON"
0023 storeFile="/raid/cmssw/Development/O2O/store/doneRuns_${preTag}_${postTag}"
0024 doExit="false"
0025 
0026 touch $storeFile
0027 
0028 log=log_at_P5_$Tag
0029 #rm -rf $log
0030 mkdir -p $log
0031 
0032 export TNS_ADMIN=/nfshome0/xiezhen/conddb/
0033 
0034 #sqlplus -S -M "HTML ON " $onlineDB < OMDSQuery.sql
0035 
0036 sqlplus -S -M "HTML ON " $onlineDB < OMDSQuery.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)}}' | sort -n| while read line;
0037 do
0038 vec=($line)
0039 
0040 echo ${vec[@]}
0041 
0042 runNb=${vec[0]}
0043 mode=${vec[1]}
0044 partition=${vec[2]}
0045 fecV=${vec[3]}
0046 fedV=${vec[4]}
0047 cabV=${vec[5]}
0048 dcuV=${vec[6]}
0049 
0050 #echo $runNb $partition $fecV $fedV $cabV
0051 
0052 fedVMaj=`echo $fedV | cut -d "." -f1`
0053 fedVmin=`echo $fedV | cut -d "." -f2`
0054 
0055 fecVMaj=`echo $fecV | cut -d "." -f1`
0056 fecVmin=`echo $fecV | cut -d "." -f2`
0057 
0058 cabVMaj=`echo $cabV | cut -d "." -f1`
0059 cabVmin=`echo $cabV | cut -d "." -f2`
0060 
0061 dcuVMaj=`echo $dcuV | cut -d "." -f1`
0062 dcuVmin=`echo $dcuV | cut -d "." -f2`
0063 
0064 if [ "$mode" == "PEDESTAL" ]; then
0065     runVer="$partition $cabV $fedV $dcuV"
0066 else
0067     runVer="$partition $cabV XXX $dcuV"
0068 fi
0069 runString="$runNb $runVer"
0070 echo -n "$runString  --  "
0071 if grep -q "$runString" $storeFile ; then
0072     echo O2O transfer already performed or not necessary
0073 else
0074       # O2O not done, let's check if it is necessary
0075     if tail -n1 $storeFile | grep -qe "$runVer" ; then
0076         echo Fed and partition not changed since last IOV was opened. O2O Not necessary
0077     elif [ 0`tail -n1 $storeFile | awk '{print $1}'` -gt $runNb ]; then 
0078         echo RunNumber $runNb violates append mode. last uploaded run is `tail -n1 $storeFile | awk '{print $1}'` 
0079         echo -e "\n Please start the o2o with a new offline tag name in file $basePath/`basename $0`\nCurrent tag is $Tag" 
0080         exit
0081     else
0082         echo Performing O2O...
0083     fi
0084 fi
0085 
0086 [[ "$doExit" != "false" ]] && break
0087 
0088 done
0089 
0090 echo ""