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"> </td>\n')
141 f.write(' <td><b>T0 Iteration</b></td><td width="20"> </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:
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 = ' \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?)