File indexing completed on 2023-04-28 04:48:06
0001 import socket
0002 import FWCore.ParameterSet.Config as cms
0003 import FWCore.ParameterSet.VarParsing as VarParsing
0004 process = cms.Process("LHCInfoPerLSPopulator")
0005 from CondCore.CondDB.CondDB_cfi import *
0006
0007
0008
0009
0010
0011 sourceConnection = 'oracle://cms_omds_adg/CMS_RUNINFO_R'
0012 if socket.getfqdn().find('.cms') != -1:
0013 sourceConnection = 'oracle://cms_omds_lb/CMS_RUNINFO_R'
0014
0015 options = VarParsing.VarParsing()
0016 options.register( 'mode'
0017 , None
0018 , VarParsing.VarParsing.multiplicity.singleton
0019 , VarParsing.VarParsing.varType.string
0020 , "The mode the fills are going to be process and the data gathered. Accepted values: duringFill endFill"
0021 )
0022 options.register( 'destinationConnection'
0023 , 'sqlite_file:lhcinfo_pop_test.db'
0024 , VarParsing.VarParsing.multiplicity.singleton
0025 , VarParsing.VarParsing.varType.string
0026 , "Connection string to the DB where payloads will be possibly written."
0027 )
0028 options.register( 'targetConnection'
0029 , ''
0030 , VarParsing.VarParsing.multiplicity.singleton
0031 , VarParsing.VarParsing.varType.string
0032 , """Connection string to the target DB:
0033 if not empty (default), this provides the latest IOV and payloads to compare;
0034 it is the DB where payloads should be finally uploaded."""
0035 )
0036 options.register( 'tag'
0037 , 'LHCInfoPerLS_PopCon_test'
0038 , VarParsing.VarParsing.multiplicity.singleton
0039 , VarParsing.VarParsing.varType.string
0040 , "Tag written in destinationConnection and finally appended in targetConnection."
0041 )
0042 options.register( 'messageLevel'
0043 , 0
0044 , VarParsing.VarParsing.multiplicity.singleton
0045 , VarParsing.VarParsing.varType.int
0046 , "Message level; default to 0"
0047 )
0048 options.register( 'startTime'
0049 , '2021-09-10 03:10:18.000'
0050 , VarParsing.VarParsing.multiplicity.singleton
0051 , VarParsing.VarParsing.varType.string
0052 , """Date and time of the start of processing:
0053 processes only fills starting at startTime or later"""
0054 )
0055 options.register( 'endTime'
0056 , ''
0057 , VarParsing.VarParsing.multiplicity.singleton
0058 , VarParsing.VarParsing.varType.string
0059 , """Date and time of the start of processing:
0060 processes only fills starting before endTime;
0061 default to empty string which sets no restriction"""
0062 )
0063 options.parseArguments()
0064 if options.mode is None:
0065 raise ValueError("mode argument not provided. Supported modes are: duringFill endFill")
0066 if options.mode not in ("duringFill", "endFill"):
0067 raise ValueError("Wrong mode argument. Supported modes are: duringFill endFill")
0068
0069 CondDBConnection = CondDB.clone( connect = cms.string( options.destinationConnection ) )
0070 CondDBConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel )
0071
0072 process.MessageLogger = cms.Service("MessageLogger",
0073 cout = cms.untracked.PSet(threshold = cms.untracked.string('INFO')),
0074 destinations = cms.untracked.vstring('cout')
0075 )
0076
0077 process.source = cms.Source("EmptyIOVSource",
0078 lastValue = cms.uint64(1),
0079 timetype = cms.string('runnumber'),
0080 firstValue = cms.uint64(1),
0081 interval = cms.uint64(1)
0082 )
0083
0084 process.PoolDBOutputService = cms.Service("PoolDBOutputService",
0085 CondDBConnection,
0086 timetype = cms.untracked.string('timestamp'),
0087 toPut = cms.VPSet(cms.PSet(record = cms.string('LHCInfoPerLSRcd'),
0088 tag = cms.string( options.tag )
0089 )
0090 )
0091 )
0092
0093 process.Test1 = cms.EDAnalyzer("LHCInfoPerLSPopConAnalyzer",
0094 SinceAppendMode = cms.bool(True),
0095 record = cms.string('LHCInfoPerLSRcd'),
0096 name = cms.untracked.string('LHCInfo'),
0097 Source = cms.PSet(fill = cms.untracked.uint32(6417),
0098 startTime = cms.untracked.string(options.startTime),
0099 endTime = cms.untracked.string(options.endTime),
0100 samplingInterval = cms.untracked.uint32( 600 ),
0101 endFill = cms.untracked.bool(True if options.mode == "endFill" else False),
0102 name = cms.untracked.string("LHCInfoPerLSPopConSourceHandler"),
0103 connectionString = cms.untracked.string("oracle://cms_orcon_adg/CMS_RUNTIME_LOGGER"),
0104 DIPSchema = cms.untracked.string("CMS_BEAM_COND"),
0105 omsBaseUrl = cms.untracked.string("http://vocms0184.cern.ch/agg/api/v1"),
0106 authenticationPath = cms.untracked.string(""),
0107 debug=cms.untracked.bool(False)
0108 ),
0109 loggingOn = cms.untracked.bool(True),
0110 IsDestDbCheckedInQueryLog = cms.untracked.bool(False)
0111 )
0112
0113 process.p = cms.Path(process.Test1)