Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:51:52

0001 # A script to run as a cron job to execute O2O for EcalPedestals
0002 # Prerequisites: 1. A PL/SQL procedure to execute payload
0003 #                   transformation 
0004 #                2. A bootstrapped CMSSW project to set your
0005 #                   environment to use the programs setup_pool_database and
0006 #                   cmscond_build_iov 
0007 #                3. The mapping xml files for the object to do o2o on
0008 # Warning: O2O needs to have been executed once before, or remove
0009 #          the -a option on cmscond_build_iov for the first execution
0010 # TODO:  CORAL_AUTH_* shouldn't need to be set!  Should use authentication XML
0011 
0012 # Basic paths and variables
0013 O2ODIR=/home/egeland/O2O
0014 CMSSW_VER=CMSSW_0_5_0
0015 SCRAM_PATH=/afs/cern.ch/cms/utils
0016 SCRAM_ARCH=slc3_ia32_gcc323
0017 CMSSW_DIR=${O2ODIR}/${CMSSW_VER}
0018 LOG=$O2ODIR/o2o-log.txt
0019 
0020 # Info about the object to be o2o'd
0021 MAPPING_PATH=${CMSSW_DIR}/src/CondTools/Ecal/src
0022 MAPPING_FILE=${MAPPING_PATH}/EcalPedestals-mapping-custom_1.0.xml
0023 OBJECT_LIBRARY=CondFormatsEcalObjects
0024 OBJECT_NAME=EcalPedestals
0025 OBJECT_TABLE=ECALPEDESTALS
0026 TAG=from_online
0027 
0028 # Online DB info
0029 ONLINE_DB=ecalh4db
0030 ONLINE_DB_USER=cond01
0031 ONLINE_DB_PASSWORD=******
0032 
0033 # Offline DB info
0034 OFFLINE_DB=devdb10
0035 OFFLINE_DB_USER=cms_ecal
0036 OFFLINE_DB_PASSWORD=******
0037 OFFLINE_CONNECT=oracle://${OFFLINE_DB}/${OFFLINE_DB_USER}
0038 
0039 # POOL catalog info
0040 #MY_CATALOG=xmlcatalog_file:${O2ODIR}/ecal-offline-catalog.xml
0041 MY_CATALOG=relationalcatalog_oracle://${OFFLINE_DB}/${OFFLINE_DB_USER}
0042 
0043 # Log the date
0044 echo -n [`date "+%Y-%m-%d %H:%M:%S"`] >> $LOG;
0045 T_START=`date +%s`
0046 
0047 
0048 # Set the environment
0049 echo -n " Setting env..." >> $LOG;
0050 PATH=$PATH:$SCRAM_PATH
0051 cd $CMSSW_DIR;
0052 eval `scramv1 runtime -sh`;
0053 cd $O20DIR;
0054 
0055 COND_UTIL_PATH=${LOCALRT}/src/CondTools/Utilities/bin
0056 PATH=$PATH:$COND_UTIL_PATH
0057 
0058 export POOL_CATALOG=${MY_CATALOG}
0059 echo $POOL_CATALOG
0060 export CORAL_AUTH_USER=$OFFLINE_DB_USER
0061 export CORAL_AUTH_PASSWORD=$OFFLINE_DB_PASSWORD
0062 #export POOL_AUTH_PATH=${O2ODIR}
0063 
0064 ###
0065 ### O2O happens here
0066 ###
0067 
0068 # Transfer payload data
0069 echo -n "Transfering payload data..." >> $LOG;
0070 echo "call payload_o2o();" | sqlplus -S ${ONLINE_DB_USER}/${ONLINE_DB_PASSWORD}@${ONLINE_DB} 2>> $LOG
0071 
0072 # Poolify offline objects
0073 echo -n "Registering to POOL..." >> $LOG;
0074 setup_pool_database $OBJECT_NAME \
0075                     $OBJECT_LIBRARY \
0076                     $OFFLINE_CONNECT \
0077                     $MAPPING_FILE -o $O2ODIR 2>>$LOG
0078 
0079 # Assign iov
0080 echo -n "Assigning IOV..." >> $LOG;
0081 cmscond_build_iov -c $OFFLINE_CONNECT \
0082                   -d $OBJECT_LIBRARY \
0083                   -t $OBJECT_TABLE \
0084                   -o $OBJECT_NAME \
0085                   -a $TAG 2>>$LOG
0086 
0087 # Log the duration of the O2O
0088 T_FINISH=`date +%s`;
0089 T_JOB=$(($T_FINISH-$T_START))
0090 echo "Done ($T_JOB s)." >> $LOG;