CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 dqmRunConfig = dqmRunConfigDefaults[dqmRunConfigType]
47 
48 # load the options from the config file, if set
49 if dqmFileConfig.has_option("host", "collectorPort"):
50  dqmRunConfig.collectorPort = int(dqmFileConfig.get("host", "collectorPort"))
51 
52 if dqmFileConfig.has_option("host", "collectorHost"):
53  dqmRunConfig.collectorHost = dqmFileConfig.get("host", "collectorHost")
54 
55 
56 # now start the actual configuration
57 print("dqmRunConfig:", dqmRunConfig)
58 
60 
61 DQM = cms.Service("DQM",
62  debug = cms.untracked.bool(False),
63  publishFrequency = cms.untracked.double(5.0),
64  collectorPort = dqmRunConfig.collectorPort,
65  collectorHost = dqmRunConfig.collectorHost,
66  filter = cms.untracked.string(''),
67 )
68 
69 DQMMonitoringService = cms.Service("DQMMonitoringService")
70 
73 
74 # upload should be either a directory or a symlink for dqm gui destination
75 dqmSaver.path = "./upload"
76 dqmSaver.tag = "PID%06d" % os.getpid()
77 dqmSaver.producer = 'DQM'
78 dqmSaver.backupLumiCount = 15
79 
80 # Add Protobuf DQM saver
81 from DQMServices.FileIO.DQMFileSaverPB_cfi import dqmSaver as dqmSaverPB
82 
83 dqmSaverPB.path = './upload/pb'
84 dqmSaverPB.tag = 'PID%06d' % os.getpid()
85 dqmSaverPB.producer = 'DQM'
86 dqmSaverPB.fakeFilterUnitMode = True
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def loadDQMRunConfigFromFile