Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-26 02:34:08

0001 import os
0002 import FWCore.ParameterSet.Config as cms
0003 import configparser as ConfigParser
0004 
0005 def loadDQMRunConfigFromFile():
0006     # try reading the config
0007     conf_locations = [
0008         "/etc/dqm_run_config",
0009         #os.path.expanduser("~/.dqm_run_config"),
0010         os.path.join(os.curdir, "dqm_run_config"),
0011     ]
0012     
0013     config = ConfigParser.ConfigParser()
0014     files_read = config.read(conf_locations)
0015 
0016     print("Loaded configuration file from:", files_read)
0017     return config
0018 
0019 # default values, config in file overrides parts of it
0020 # dqmEnv and dqmSaver will configure from this pset
0021 dqmRunConfigDefaults = {
0022     'userarea': cms.PSet(
0023         type = cms.untracked.string("userarea"),
0024         collectorPort = cms.untracked.int32(9190),
0025         collectorHost = cms.untracked.string('127.0.0.1'),
0026     ),
0027     'playback': cms.PSet(
0028         type = cms.untracked.string("playback"),
0029         collectorPort = cms.untracked.int32(9090),
0030         collectorHost = cms.untracked.string('dqm-integration.cms'),
0031     ),
0032     'production': cms.PSet(
0033         type = cms.untracked.string("production"),
0034         collectorPort = cms.untracked.int32(9090),
0035         collectorHost = cms.untracked.string('dqm-prod-local.cms'),
0036     ),
0037 }
0038 
0039 # type should be loaded first, to populate the proper defaults
0040 dqmFileConfig = loadDQMRunConfigFromFile()
0041 dqmRunConfigType = "userarea"
0042 if dqmFileConfig.has_option("host", "type"):
0043     dqmRunConfigType = dqmFileConfig.get("host", "type")
0044     
0045 isDqmPlayback = cms.PSet( value = cms.untracked.bool( dqmRunConfigType == "playback" ) )
0046 isDqmProduction = cms.PSet( value = cms.untracked.bool( dqmRunConfigType == "production" ) )
0047 
0048 dqmRunConfig = dqmRunConfigDefaults[dqmRunConfigType]
0049 
0050 # load the options from the config file, if set
0051 if dqmFileConfig.has_option("host", "collectorPort"):
0052     dqmRunConfig.collectorPort = int(dqmFileConfig.get("host", "collectorPort"))
0053 
0054 if dqmFileConfig.has_option("host", "collectorHost"):
0055     dqmRunConfig.collectorHost = dqmFileConfig.get("host", "collectorHost")
0056 
0057 # now start the actual configuration
0058 print("dqmRunConfig:", dqmRunConfig)
0059 
0060 from DQMServices.Core.DQMStore_Online_cfi import *
0061 
0062 DQM = cms.Service("DQM",
0063                   debug = cms.untracked.bool(False),
0064                   publishFrequency = cms.untracked.double(5.0),
0065                   collectorPort = dqmRunConfig.collectorPort,
0066                   collectorHost = dqmRunConfig.collectorHost,
0067                   filter = cms.untracked.string(''),
0068 )
0069 
0070 DQMMonitoringService = cms.Service("DQMMonitoringService")
0071 
0072 from DQMServices.Components.DQMEventInfo_cfi import *
0073 from DQMServices.FileIO.DQMFileSaverOnline_cfi import *
0074 
0075 # upload should be either a directory or a symlink for dqm gui destination
0076 dqmSaver.path = "./upload" 
0077 dqmSaver.tag = "PID%06d" % os.getpid()
0078 dqmSaver.producer = 'DQM'
0079 dqmSaver.backupLumiCount = 15
0080 
0081 # Add Protobuf DQM saver
0082 from DQMServices.FileIO.DQMFileSaverPB_cfi import dqmSaver as dqmSaverPB
0083 
0084 dqmSaverPB.path = './upload/pb'
0085 dqmSaverPB.tag = 'PID%06d' % os.getpid()
0086 dqmSaverPB.producer = 'DQM'
0087 dqmSaverPB.fakeFilterUnitMode = True