1 |
import os.path, socket ; global CONFIGDIR
|
2 |
def reglob(pattern):
|
3 |
"""Extended version of glob that uses regular expressions."""
|
4 |
from os import listdir
|
5 |
import re
|
6 |
cwd = pattern.rsplit('/',1)[0]
|
7 |
f_pattern= pattern.rsplit('/',1)[-1]
|
8 |
pat=re.compile(f_pattern)
|
9 |
g = ["%s/%s" % (cwd,f) for f in listdir(cwd) if pat.match(f)]
|
10 |
return g
|
11 |
|
12 |
CONFIGDIR = os.path.normcase(os.path.abspath(__file__)).rsplit('/', 1)[0]
|
13 |
BASEDIR = CONFIGDIR.replace("/current/config/dqmgui", "")
|
14 |
STATEDIR = "%s/state/dqmgui/online" % BASEDIR
|
15 |
LOGDIR = "%s/logs/dqmgui/online" % BASEDIR
|
16 |
|
17 |
# Modifiable parameters.
|
18 |
LAYOUTS = reglob("%s/layouts/[^-_]*-layouts.py" % CONFIGDIR)
|
19 |
LAYOUTS += reglob("%s/layouts/shift_[^-_]*_layout.py" % CONFIGDIR)
|
20 |
LAYOUTS += reglob("%s/layouts/.*_overview_layouts.py" % CONFIGDIR)
|
21 |
|
22 |
# Do not modify configuration below this line.
|
23 |
DQMSERVERS = ["dqm-prod-local", "dqm-prod-offsite", "dqm-integration", "dqm-test"]
|
24 |
HOST = socket.gethostname().lower()
|
25 |
DOMAIN = socket.getfqdn().split('.',1)[-1].lower()
|
26 |
HOSTADDR = socket.getaddrinfo(HOST, None)[0][4][0]
|
27 |
BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
28 |
HOSTALIAS = HOST
|
29 |
COLLHOST = 'localhost'
|
30 |
COLLPORT = DOMAIN == 'cms' and 9190 or 8061
|
31 |
#SERVICENAME = 'Online Development'
|
32 |
SERVICENAME = 'ECAL DQM'
|
33 |
#SERVERPORT = 8070
|
34 |
SERVERPORT = 8030
|
35 |
#BASEURL = '/dqm/online-dev'
|
36 |
BASEURL = '/dqm/ecal'
|
37 |
UPLOADDIR = "%s/uploads" % STATEDIR
|
38 |
FILEREPO = { "ROOT": "%s/data" % STATEDIR }
|
39 |
|
40 |
# Figure out a preferred alias for this out (if any)
|
41 |
for alias in DQMSERVERS:
|
42 |
try:
|
43 |
if len([x for x in socket.getaddrinfo(alias, None) if x[4][0] == HOSTADDR]):
|
44 |
HOSTALIAS = alias
|
45 |
break
|
46 |
except: pass
|
47 |
|
48 |
# Figure out settings for DQM servers
|
49 |
if HOSTALIAS in DQMSERVERS:
|
50 |
COLLPORT = 9090
|
51 |
SERVERPORT = 8030
|
52 |
if HOSTALIAS == 'dqm-integration':
|
53 |
SERVICENAME = 'Online Playback'
|
54 |
BASEURL = '/dqm/online-playback'
|
55 |
|
56 |
else:
|
57 |
FILEREPO = { "ROOT": "/dqmdata/dqm/repository/original/OnlineData",
|
58 |
"Original": "/dqmdata/dqm/repository/original/OnlineData",
|
59 |
"Merged": "/dqmdata/dqm/repository/merged/OnlineData" }
|
60 |
COLLHOST = HOSTALIAS != 'dqm-prod-local' and 'dqm-prod-local.cms' or 'localhost'
|
61 |
if HOSTALIAS == 'dqm-test':
|
62 |
SERVICENAME = 'Online Test'
|
63 |
BASEURL = '/dqm/online-test'
|
64 |
|
65 |
else:
|
66 |
SERVICENAME = 'Online'
|
67 |
BASEURL = '/dqm/online'
|
68 |
UPLOADDIR = "/dqmdata/dqm/uploads"
|
69 |
|
70 |
# Server configuration.
|
71 |
modules = ("Monitoring.DQM.GUI",)
|
72 |
|
73 |
#server.instrument = 'valgrind --num-callers=999 `cmsvgsupp` --error-limit=no'
|
74 |
#server.instrument = 'valgrind --tool=helgrind --num-callers=999 --error-limit=no'
|
75 |
#server.instrument = 'igprof -d -t python -pp'
|
76 |
#server.instrument = 'igprof -d -t python -mp'
|
77 |
server.localBase = HOSTALIAS
|
78 |
server.serverDir = STATEDIR
|
79 |
server.port = SERVERPORT
|
80 |
server.logFile = '%s/weblog-%%Y%%m%%d.log' % LOGDIR
|
81 |
server.baseUrl = BASEURL
|
82 |
server.title = 'CMS data quality'
|
83 |
server.serviceName = SERVICENAME
|
84 |
|
85 |
server.plugin('render', "%s/style/*.cc" % CONFIGDIR)
|
86 |
server.extend('DQMRenderLink', server.pathOfPlugin('render'))
|
87 |
server.extend('DQMToJSON')
|
88 |
server.extend('DQMFileAccess', None, UPLOADDIR,FILEREPO)
|
89 |
server.source('DQMUnknown')
|
90 |
server.source('DQMOverlay')
|
91 |
server.source('DQMStripChart')
|
92 |
server.source('DQMLive', "%s:%s" % (COLLHOST,COLLPORT))
|
93 |
server.source('DQMArchive', "%s/ix" % STATEDIR, '^/Global/')
|
94 |
server.source('DQMLayout')
|
95 |
|
96 |
execfile(CONFIGDIR + "/dqm-services.py")
|
97 |
execfile(CONFIGDIR + "/workspaces-online.py")
|