Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 import socket
0002 import FWCore.ParameterSet.Config as cms
0003 import FWCore.ParameterSet.VarParsing as VarParsing
0004 from CondCore.CondDB.CondDB_cfi import *
0005 
0006 sourceConnection = 'oracle://cms_omds_adg/CMS_RUNINFO_R'
0007 if socket.getfqdn().find('.cms') != -1:
0008     sourceConnection = 'oracle://cms_omds_lb/CMS_RUNINFO_R'
0009 
0010 options = VarParsing.VarParsing()
0011 options.register( 'runNumber'
0012                 , 1 #default value
0013                 , VarParsing.VarParsing.multiplicity.singleton
0014                 , VarParsing.VarParsing.varType.int
0015                 , "Run number to be uploaded."
0016                   )
0017 options.register( 'destinationConnection'
0018                 , 'sqlite_file:RunInfo_PopCon_test.db' #default value
0019                 , VarParsing.VarParsing.multiplicity.singleton
0020                 , VarParsing.VarParsing.varType.string
0021                 , "Connection string to the DB where payloads will be possibly written."
0022                   )
0023 options.register( 'targetConnection'
0024                 , '' #default value
0025                 , VarParsing.VarParsing.multiplicity.singleton
0026                 , VarParsing.VarParsing.varType.string
0027                 , """Connection string to the target DB:
0028                      if not empty (default), this provides the latest IOV and payloads to compare;
0029                      it is the DB where payloads should be finally uploaded."""
0030                   )
0031 options.register( 'tag'
0032                 , 'RunInfo_PopCon_test'
0033                 , VarParsing.VarParsing.multiplicity.singleton
0034                 , VarParsing.VarParsing.varType.string
0035                 , "Tag written in destinationConnection and finally appended in targetConnection."
0036                   )
0037 options.register( 'messageLevel'
0038                 , 0 #default value
0039                 , VarParsing.VarParsing.multiplicity.singleton
0040                 , VarParsing.VarParsing.varType.int
0041                 , "Message level; default to 0"
0042                   )
0043 options.parseArguments()
0044 
0045 CondDBConnection = CondDB.clone( connect = cms.string( options.destinationConnection ) )
0046 CondDBConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel )
0047 
0048 OMDSDBConnection = CondDB.clone( connect = cms.string( sourceConnection ) )
0049 OMDSDBConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel )
0050 
0051 process = cms.Process( "RunInfoPopulator" )
0052 
0053 process.MessageLogger = cms.Service( "MessageLogger"
0054                                    , destinations = cms.untracked.vstring( 'cout' )
0055                                    , cout = cms.untracked.PSet( threshold = cms.untracked.string( 'INFO' ) )
0056                                      )
0057 
0058 if options.messageLevel == 3:
0059     #enable LogDebug output: remember the USER_CXXFLAGS="-DEDM_ML_DEBUG" compilation flag!
0060     process.MessageLogger.cout = cms.untracked.PSet( threshold = cms.untracked.string( 'DEBUG' ) )
0061     process.MessageLogger.debugModules = cms.untracked.vstring( '*' )
0062 
0063 process.source = cms.Source( "EmptyIOVSource"
0064                            , lastValue = cms.uint64( options.runNumber )
0065                            , timetype = cms.string( 'runnumber' )
0066                            , firstValue = cms.uint64( options.runNumber )
0067                            , interval = cms.uint64( 1 )
0068                              )
0069 
0070 process.PoolDBOutputService = cms.Service( "PoolDBOutputService"
0071                                          , CondDBConnection
0072                                          , timetype = cms.untracked.string( 'runnumber' )
0073                                          , toPut = cms.VPSet( cms.PSet( record = cms.string( 'RunInfoRcd' )
0074                                                                       , tag = cms.string( options.tag )
0075                                                                         )
0076                                                               )
0077                                           )
0078 
0079 process.popConRunInfo = cms.EDAnalyzer( "RunInfoPopConAnalyzer"
0080                                       , SinceAppendMode = cms.bool( True )
0081                                       , record = cms.string( 'RunInfoRcd' )
0082                                       , Source = cms.PSet( OMDSDBConnection
0083                                                          , runNumber = cms.uint64( options.runNumber )
0084                                                            )
0085                                       , loggingOn = cms.untracked.bool( True )
0086                                       , targetDBConnectionString = cms.untracked.string( options.targetConnection )
0087                                         )
0088 
0089 process.p = cms.Path( process.popConRunInfo )