CMS 3D CMS Logo

environment_cfi.py
Go to the documentation of this file.
1 from __future__ import print_function
2 import os
3 import FWCore.ParameterSet.Config as cms
4 import configparser as ConfigParser
5 
7  # try reading the config
8  conf_locations = [
9  "/etc/dqm_run_config",
10  #os.path.expanduser("~/.dqm_run_config"),
11  os.path.join(os.curdir, "dqm_run_config"),
12  ]
13 
14  config = ConfigParser.ConfigParser()
15  files_read = config.read(conf_locations)
16 
17  print("Loaded configuration file from:", files_read)
18  return config
19 
20 # default values, config in file overrides parts of it
21 # dqmEnv and dqmSaver will configure from this pset
22 dqmRunConfigDefaults = {
23  'userarea': cms.PSet(
24  type = cms.untracked.string("userarea"),
25  collectorPort = cms.untracked.int32(9190),
26  collectorHost = cms.untracked.string('127.0.0.1'),
27  ),
28  'playback': cms.PSet(
29  type = cms.untracked.string("playback"),
30  collectorPort = cms.untracked.int32(9090),
31  collectorHost = cms.untracked.string('dqm-integration.cms'),
32  ),
33  'production': cms.PSet(
34  type = cms.untracked.string("production"),
35  collectorPort = cms.untracked.int32(9090),
36  collectorHost = cms.untracked.string('dqm-prod-local.cms'),
37  ),
38 }
39 
40 # type should be loaded first, to populate the proper defaults
41 dqmFileConfig = loadDQMRunConfigFromFile()
42 dqmRunConfigType = "userarea"
43 if dqmFileConfig.has_option("host", "type"):
44  dqmRunConfigType = dqmFileConfig.get("host", "type")
45 
46 isDqmPlayback = cms.PSet( value = cms.untracked.bool( dqmRunConfigType == "playback" ) )
47 isDqmProduction = cms.PSet( value = cms.untracked.bool( dqmRunConfigType == "production" ) )
48 
49 dqmRunConfig = dqmRunConfigDefaults[dqmRunConfigType]
50 
51 # load the options from the config file, if set
52 if dqmFileConfig.has_option("host", "collectorPort"):
53  dqmRunConfig.collectorPort = int(dqmFileConfig.get("host", "collectorPort"))
54 
55 if dqmFileConfig.has_option("host", "collectorHost"):
56  dqmRunConfig.collectorHost = dqmFileConfig.get("host", "collectorHost")
57 
58 # now start the actual configuration
59 print("dqmRunConfig:", dqmRunConfig)
60 
62 
63 DQM = cms.Service("DQM",
64  debug = cms.untracked.bool(False),
65  publishFrequency = cms.untracked.double(5.0),
66  collectorPort = dqmRunConfig.collectorPort,
67  collectorHost = dqmRunConfig.collectorHost,
68  filter = cms.untracked.string(''),
69 )
70 
71 DQMMonitoringService = cms.Service("DQMMonitoringService")
72 
75 
76 # upload should be either a directory or a symlink for dqm gui destination
77 dqmSaver.path = "./upload"
78 dqmSaver.tag = "PID%06d" % os.getpid()
79 dqmSaver.producer = 'DQM'
80 dqmSaver.backupLumiCount = 15
81 
82 # Add Protobuf DQM saver
83 from DQMServices.FileIO.DQMFileSaverPB_cfi import dqmSaver as dqmSaverPB
84 
85 dqmSaverPB.path = './upload/pb'
86 dqmSaverPB.tag = 'PID%06d' % os.getpid()
87 dqmSaverPB.producer = 'DQM'
88 dqmSaverPB.fakeFilterUnitMode = True
def loadDQMRunConfigFromFile()
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47