ATLAS Offline Software
Loading...
Searching...
No Matches
generateDQIndexFiles Namespace Reference

Functions

 generateDQIndexFiles (installPath, project, indexFile, runListFile, htmlAddress)
 buildRunDictionary ()
 deleteTmpDirectories (runDict, tmpDirList)
 printRunDictionary (runDict)
 writeIndexFile (runDict, indexFile, project)
 writeRunListXML (runDict, runListFile, htmlAddress)
 usage ()

Variables

str VERSION = '$Id: generateDQIndexFiles.py,v 1.4 2009-03-31 15:49:37 ponyisi Exp $'
 installPath = sys.argv[1]
 project = sys.argv[2]
 indexFile = sys.argv[3]
 runListFile = sys.argv[4]
 htmlAddress = sys.argv[5]

Function Documentation

◆ buildRunDictionary()

generateDQIndexFiles.buildRunDictionary ( )

Definition at line 32 of file generateDQIndexFiles.py.

32def buildRunDictionary():
33
34
36
37 runDict = { }
38 allTmpDirList = [ ]
39 tmpDirList = [ ]
40
41 for root, dirs, files in os.walk("."):
42 removeDir = []
43 if "history_plot" in dirs:
44 dirs.remove("history_plot")
45 for name in dirs:
46 if( name.find('run_') > -1 ):
47 removeDir.append(name)
48 if len(removeDir) > 0:
49 stream = root.replace("./","")
50 proc = 0
51 proci = stream.find("/")
52 if proci != -1:
53 try:
54 proc = int(stream[:proci])
55 except ValueError:
56 proc = 0
57 if proc != 0:
58 for rundir in dirs:
59 run = rundir.replace("run_","")
60 procDict = { }
61 streamList = [ ]
62 if run in runDict:
63 procDict = runDict[run]
64 if proc in procDict.keys():
65 streamList = procDict[proc]
66 procText = str(proc) + "/"
67 shortStream = stream.replace(procText,"")
68 if shortStream.find("tmp_") == 0:
69 allTmpDirList.append( (stream,run,proc) )
70 streamList.append(stream)
71 procDict[proc] = streamList
72 runDict[run] = procDict
73 for name in removeDir:
74 dirs.remove(name)
75
76 for tmpStream,run,proc in allTmpDirList:
77 stream = tmpStream.replace("tmp_","")
78 procDict = runDict[run]
79 streamList = procDict[proc]
80 if stream in streamList:
81 tmpDir = tmpStream + "/run_" + run
82 tmpDirList.append(tmpDir)
83 streamList.remove(tmpStream)
84
85 return runDict, tmpDirList
86
87
if(febId1==febId2)

◆ deleteTmpDirectories()

generateDQIndexFiles.deleteTmpDirectories ( runDict,
tmpDirList )

Definition at line 88 of file generateDQIndexFiles.py.

88def deleteTmpDirectories( runDict, tmpDirList ):
89 for tmpDir in tmpDirList:
90 cmd = "rm -rf %s" % tmpDir
91 print cmd
92 os.system( cmd )
93
94

◆ generateDQIndexFiles()

generateDQIndexFiles.generateDQIndexFiles ( installPath,
project,
indexFile,
runListFile,
htmlAddress )

Definition at line 11 of file generateDQIndexFiles.py.

11def generateDQIndexFiles( installPath, project, indexFile, runListFile, htmlAddress ):
12
13 print ""
14 print "!! generateDQIndexFiles !!"
15 print "CVS version:"
16 print VERSION
17
18 origdir = os.getcwd()
19 os.chdir( installPath )
20
21 runDict, tmpDirList = buildRunDictionary()
22
23 #printRunDictionary( runDict )
24 deleteTmpDirectories( runDict, tmpDirList )
25 writeIndexFile( runDict, indexFile, project )
26 writeRunListXML( runDict, runListFile, htmlAddress )
27
28 os.chdir( origdir )
29 print ""
30
31

◆ printRunDictionary()

generateDQIndexFiles.printRunDictionary ( runDict)

Definition at line 95 of file generateDQIndexFiles.py.

95def printRunDictionary( runDict ):
96 reversedRunKeys = [(int(x), x) for x in runDict.keys()]
97 reversedRunKeys.sort()
98 reversedRunKeys.reverse()
99 reversedRunKeys = [x[1] for x in reversedRunKeys]; del x
100 for run in reversedRunKeys:
101 margin = run + ": "
102 procDict = runDict[run]
103 sortedProcDictKeys = procDict.keys()
104 sortedProcDictKeys.sort()
105 for proc in sortedProcDictKeys:
106 streamList = procDict[proc]
107 sortedStreamList = [ ]
108 for stream in streamList:
109 if stream.find("Express") != -1:
110 sortedStreamList.append(stream)
111 streamList.remove(stream)
112 break
113 tmpSortedList = streamList
114 tmpSortedList.sort()
115 for stream in tmpSortedList:
116 sortedStreamList.append(stream)
117 print margin, sortedStreamList
118 margin = " "
119
120

◆ usage()

generateDQIndexFiles.usage ( )

Definition at line 287 of file generateDQIndexFiles.py.

287def usage():
288 cmdi = sys.argv[0].rfind("/")
289 cmd = sys.argv[0][cmdi+1:]
290 print ""
291 print "Usage: ", cmd, "<installPath> <project> <indexFile> <runListFile> <htmlAddress>"
292 print ""
293
294
StatusCode usage()

◆ writeIndexFile()

generateDQIndexFiles.writeIndexFile ( runDict,
indexFile,
project )

Definition at line 121 of file generateDQIndexFiles.py.

121def writeIndexFile( runDict, indexFile, project ):
122 import xmlrpclib, time
123 s = xmlrpclib.ServerProxy('http://atlasdqm.cern.ch:8080')
124 print "Writing HTML index file..."
125 f = open(indexFile,'w')
126 f.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n')
127 f.write('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n')
128 f.write('<head>\n')
129 f.write('<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />\n')
130 f.write('<title>ATLAS Data-Quality Monitoring: '+project+'</title>\n')
131 f.write('<link rel="stylesheet" href="atlasdqm.css" type="text/css" />\n')
132 f.write('<script type="text/javascript" src="AllDirs.js"><!-- dont contract--></script>')
133 f.write('</head>\n')
134 f.write('<body>\n\n')
135 f.write('<h1>'+project+' Monitoring</h1>\n\n')
136 f.write('<p><font class="Note">\n')
137 f.write('***Indicates reconstruction is in progress; histograms represent accumulated statistics and are temporary.\n')
138 f.write('</font></p>\n\n')
139 f.write('<table class="Catalogue">\n')
140 f.write('<tr><td><b>Run Number</b></td><td width="20">&nbsp;</td>\n')
141 f.write(' <td><b>T0 Iteration</b></td><td width="20">&nbsp;</td>\n')
142 f.write(' <td><b>Streams</b></td></tr>\n')
143 f.write('\n')
144
145 bgcolor = '#bbffff'
146 writeBGColor = False
147 reversedRunDictKeys = [(int(x), x) for x in runDict.keys()]
148 reversedRunDictKeys.sort()
149 reversedRunDictKeys.reverse()
150 reversedRunDictKeys = [x[1] for x in reversedRunDictKeys]; del x
151 for run in reversedRunDictKeys:
152 mouseovertext = ''
153 try:
154 runinfo = s.get_run_information({'low_run': run, 'high_run': run}).get(run, None)
155 if runinfo != None:
156 mouseovertext = 'Run %s<br/>Run Start: %s<br/>' % (run, time.strftime('%Y-%m-%d %H:%M %Z', time.localtime(runinfo[4])))
157 if runinfo[5] != 0:
158 mouseovertext += ('Run End: %s<br/>' % time.strftime('%Y-%m-%d %H:%M %Z', time.localtime(runinfo[5])))
159 if runinfo[3] != -1:
160 mouseovertext += ('Event Filter Events: %s<br/>' % runinfo[3])
161 mouseovertext += ('Project Tag: %s<br/>' % runinfo[1])
162 if runinfo[2] != '':
163 mouseovertext += ('Partition: %s<br/>' % runinfo[2])
164 except Exception, e:
165 print e
166 procDict = runDict[run]
167 nproc = len(procDict.keys())
168 margin = ' <td rowspan="' + str(nproc) + '" valign="top" align="right">'
169 margin += '<a href="http://atlas-service-db-runlist.web.cern.ch/atlas-service-db-runlist/cgi-bin/runDetails.py?run=' + str(run) + """" onMouseover="showhint('""" + mouseovertext + """', this, event, '400px')">"""
170 margin += str(run) + '</a></td>\n'
171 margin += ' <td rowspan="' + str(nproc) + '"></td>\n'
172 sortedProcKeys = procDict.keys()
173 sortedProcKeys.sort()
174 for proc in sortedProcKeys:
175 if(writeBGColor):
176 f.write('<tr bgcolor="' + bgcolor + '">\n')
177 else:
178 f.write('<tr>\n')
179 f.write(margin)
180 f.write(' <td align="right">' + str(proc) + '</td>\n')
181 f.write(' <td></td>\n')
182 f.write(' <td>\n')
183
184 endtext = ""
185
186 streamList = procDict[proc]
187 sortedStreamList = [ ]
188 for stream in streamList:
189 if stream.find("Express") != -1:
190 sortedStreamList.append(stream)
191 streamList.remove(stream)
192 break
193 tmpSortedList = streamList
194 streamList.sort()
195 for stream in streamList:
196 sortedStreamList.append(stream)
197
198 for stream in sortedStreamList:
199 link = stream + '/run_' + run
200 proci = stream.rfind("/")
201 shortStream = stream[proci+1:]
202 if shortStream.find("tmp_") == 0:
203 shortStream = shortStream.replace("tmp_","")
204 shortStream += "***"
205 f.write(endtext)
206 f.write(' [<a href="' + link + '">' + shortStream + '</a>]')
207 endtext = '&nbsp;&nbsp;\n'
208
209 f.write('\n </td>\n')
210 f.write('</tr>\n')
211 margin = ""
212 writeBGColor = not writeBGColor
213
214 f.write('</table>\n')
215 f.write('</body>\n')
216 f.write('</html>\n')
217 f.close()
218
219
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130

◆ writeRunListXML()

generateDQIndexFiles.writeRunListXML ( runDict,
runListFile,
htmlAddress )

Definition at line 220 of file generateDQIndexFiles.py.

220def writeRunListXML( runDict, runListFile, htmlAddress ):
221 print "Writing run list XML file..."
222
223 f = open(runListFile,'w')
224 f.write('<?xml version="1.0" encoding="ISO-8859-1"?>\n')
225 f.write('<DqFileCatalogue>\n')
226
227 streamDict = {}
228
229 for root, dirs, files in os.walk("."):
230 removeDir = []
231 for name in dirs:
232 if( name.find('run_') > -1 ):
233 removeDir.append(name)
234 if len(removeDir) > 0:
235 stream = root.replace("./","")
236 runList = []
237 proc = 0
238 proci = stream.find("/")
239 if proci != -1:
240 try:
241 proc = int(stream[:proci])
242 except ValueError:
243 proc = 0
244 if proc != 0:
245 #f.write('<Stream id=\'' + stream + '\'>\n')
246 for rundir in dirs:
247 run = rundir.replace("run_","")
248 runList.append(run)
249 #address = htmlAddress + "/" + stream + "/run_" + run
250 #f.write('<Run runNumber=\'' + run + '\'>\n')
251 #f.write('<html>' + address + '</html>\n')
252 #f.write('</Run>\n')
253 #f.write('</Stream>\n')
254 streamDict[stream] = runList
255
256 for name in removeDir:
257 dirs.remove(name)
258
259 streamList = streamDict.keys()
260 sortedStreamList = []
261 for stream in streamList:
262 if stream.find("Express") != -1:
263 sortedStreamList.append(stream)
264 streamList.remove(stream)
265 break
266 tmpSortedList = streamList
267 tmpSortedList.sort()
268 for stream in tmpSortedList:
269 sortedStreamList.append(stream)
270
271 for stream in sortedStreamList:
272 f.write('<Stream id=\'' + stream + '\'>\n')
273 runList = streamDict[stream]
274 reversedRunList = runList
275 reversedRunList.sort()
276 reversedRunList.reverse()
277 for run in reversedRunList:
278 address = htmlAddress + "/" + stream + "/run_" + run
279 f.write('<Run runNumber=\'' + run + '\'>\n')
280 f.write('<html>' + address + '</html>\n')
281 f.write('</Run>\n')
282 f.write('</Stream>\n')
283
284 f.write('</DqFileCatalogue>\n')
285
286

Variable Documentation

◆ htmlAddress

generateDQIndexFiles.htmlAddress = sys.argv[5]

Definition at line 305 of file generateDQIndexFiles.py.

◆ indexFile

generateDQIndexFiles.indexFile = sys.argv[3]

Definition at line 303 of file generateDQIndexFiles.py.

◆ installPath

generateDQIndexFiles.installPath = sys.argv[1]

Definition at line 301 of file generateDQIndexFiles.py.

◆ project

generateDQIndexFiles.project = sys.argv[2]

Definition at line 302 of file generateDQIndexFiles.py.

◆ runListFile

generateDQIndexFiles.runListFile = sys.argv[4]

Definition at line 304 of file generateDQIndexFiles.py.

◆ VERSION

str generateDQIndexFiles.VERSION = '$Id: generateDQIndexFiles.py,v 1.4 2009-03-31 15:49:37 ponyisi Exp $'

Definition at line 4 of file generateDQIndexFiles.py.