test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
environment_cfi.py
Go to the documentation of this file.
1 import os
2 import FWCore.ParameterSet.Config as cms
3 import ConfigParser
4 
6  # try reading the config
7  conf_locations = [
8  "/etc/dqm_run_config",
9  #os.path.expanduser("~/.dqm_run_config"),
10  os.path.join(os.curdir, "dqm_run_config"),
11  ]
12 
13  config = ConfigParser.ConfigParser()
14  files_read = config.read(conf_locations)
15 
16  print "Loaded configuration file from:", files_read
17  return config
18 
19 # default values, config in file overrides parts of it
20 # dqmEnv and dqmSaver will configure from this pset
21 dqmRunConfigDefaults = {
22  'userarea': cms.PSet(
23  type = cms.untracked.string("userarea"),
24  collectorPort = cms.untracked.int32(9190),
25  collectorHost = cms.untracked.string('dqm-c2d07-29.cms'),
26  ),
27  'playback': cms.PSet(
28  type = cms.untracked.string("playback"),
29  collectorPort = cms.untracked.int32(9090),
30  collectorHost = cms.untracked.string('dqm-integration.cms'),
31  ),
32  'production': cms.PSet(
33  type = cms.untracked.string("production"),
34  collectorPort = cms.untracked.int32(9090),
35  collectorHost = cms.untracked.string('dqm-prod-local.cms'),
36  ),
37 }
38 
39 # type should be loaded first, to populate the proper defaults
40 dqmFileConfig = loadDQMRunConfigFromFile()
41 dqmRunConfigType = "userarea"
42 if dqmFileConfig.has_option("host", "type"):
43  dqmRunConfigType = dqmFileConfig.get("host", "type")
44 
45 dqmRunConfig = dqmRunConfigDefaults[dqmRunConfigType]
46 
47 # load the options from the config file, if set
48 if dqmFileConfig.has_option("host", "collectorPort"):
49  dqmRunConfig.collectorPort = int(dqmFileConfig.get("host", "collectorPort"))
50 
51 if dqmFileConfig.has_option("host", "collectorHost"):
52  dqmRunConfig.collectorHost = dqmFileConfig.get("host", "collectorHost")
53 
54 
55 # now start the actual configuration
56 print "dqmRunConfig:", dqmRunConfig
57 
59 
60 DQM = cms.Service("DQM",
61  debug = cms.untracked.bool(False),
62  publishFrequency = cms.untracked.double(5.0),
63  collectorPort = dqmRunConfig.collectorPort,
64  collectorHost = dqmRunConfig.collectorHost,
65  filter = cms.untracked.string(''),
66 )
67 
68 DQMMonitoringService = cms.Service("DQMMonitoringService")
69 
72 
73 # upload should be either a directory or a symlink for dqm gui destination
74 dqmSaver.path = "./upload"
75 dqmSaver.tag = "PID%06d" % os.getpid()
76 dqmSaver.producer = 'DQM'
77 dqmSaver.backupLumiCount = 15
def loadDQMRunConfigFromFile