Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-10 01:50:19

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