2 import FWCore.ParameterSet.Config
as cms
3 import FWCore.ParameterSet.VarParsing
as VarParsing
6 sourceConnection =
'oracle://cms_omds_adg/CMS_RUNINFO_R'
7 if socket.getfqdn().
find(
'.cms') != -1:
8 sourceConnection =
'oracle://cms_omds_lb/CMS_RUNINFO_R'
11 options.register(
'runNumber'
13 , VarParsing.VarParsing.multiplicity.singleton
14 , VarParsing.VarParsing.varType.int
15 ,
"Run number to be uploaded."
17 options.register(
'destinationConnection'
18 ,
'sqlite_file:RunInfo_PopCon_test.db'
19 , VarParsing.VarParsing.multiplicity.singleton
20 , VarParsing.VarParsing.varType.string
21 ,
"Connection string to the DB where payloads will be possibly written."
23 options.register(
'targetConnection'
25 , VarParsing.VarParsing.multiplicity.singleton
26 , VarParsing.VarParsing.varType.string
27 ,
"""Connection string to the target DB:
28 if not empty (default), this provides the latest IOV and payloads to compare;
29 it is the DB where payloads should be finally uploaded."""
31 options.register(
'tag'
32 ,
'RunInfo_PopCon_test'
33 , VarParsing.VarParsing.multiplicity.singleton
34 , VarParsing.VarParsing.varType.string
35 ,
"Tag written in destinationConnection and finally appended in targetConnection."
37 options.register(
'messageLevel'
39 , VarParsing.VarParsing.multiplicity.singleton
40 , VarParsing.VarParsing.varType.int
41 ,
"Message level; default to 0"
43 options.parseArguments()
45 CondDBConnection = CondDB.clone( connect = cms.string( options.destinationConnection ) )
46 CondDBConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel )
48 OMDSDBConnection = CondDB.clone( connect = cms.string( sourceConnection ) )
49 OMDSDBConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel )
51 process = cms.Process(
"RunInfoPopulator" )
53 process.MessageLogger = cms.Service(
"MessageLogger"
54 , destinations = cms.untracked.vstring(
'cout' )
55 , cout = cms.untracked.PSet( threshold = cms.untracked.string(
'INFO' ) )
58 if options.messageLevel == 3:
60 process.MessageLogger.cout = cms.untracked.PSet( threshold = cms.untracked.string(
'DEBUG' ) )
61 process.MessageLogger.debugModules = cms.untracked.vstring(
'*' )
63 process.source = cms.Source(
"EmptyIOVSource"
64 , lastValue = cms.uint64( options.runNumber )
65 , timetype = cms.string(
'runnumber' )
66 , firstValue = cms.uint64( options.runNumber )
67 , interval = cms.uint64( 1 )
70 process.PoolDBOutputService = cms.Service(
"PoolDBOutputService"
72 , timetype = cms.untracked.string(
'runnumber' )
73 , toPut = cms.VPSet( cms.PSet( record = cms.string(
'RunInfoRcd' )
74 , tag = cms.string( options.tag )
79 process.popConRunInfo = cms.EDAnalyzer(
"RunInfoPopConAnalyzer"
80 , SinceAppendMode = cms.bool(
True )
81 , record = cms.string(
'RunInfoRcd' )
82 , Source = cms.PSet( OMDSDBConnection
83 , runNumber = cms.uint64( options.runNumber )
85 , loggingOn = cms.untracked.bool(
True )
86 , targetDBConnectionString = cms.untracked.string( options.targetConnection )
89 process.p = cms.Path( process.popConRunInfo )