CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
directories2html Namespace Reference

Functions

def build_gauge
 
def build_obj
 
def build_obj_addr
 
def directory2html
 
def encode_obj_url
 
def fairy_url
 
def fairy_url_single
 
def get_aggr_pairs_info
 
def get_comparisons
 
def get_dir_stats
 
def get_missing_objs_section
 
def get_page_footer
 
def get_page_header
 
def get_pie_tooltip
 
def get_rank_section
 
def get_subdirs_section
 
def get_summary_section
 
def get_title_section
 
def hash_name
 
def make_barchart_summary
 
def make_categories_summary
 
def make_summary_table
 
def make_twiki_table
 
def plot_size
 

Variables

 theargv = sys.argv
 

Function Documentation

def directories2html.build_gauge (   total_success_rate,
  minrate = .80,
  small = False,
  escaped = False 
)

Definition at line 493 of file directories2html.py.

Referenced by make_categories_summary(), and make_twiki_table().

494 def build_gauge(total_success_rate,minrate=.80,small=False,escaped=False):
495  total_success_rate_scaled=(total_success_rate-minrate)
496  total_success_rate_scaled_repr=total_success_rate_scaled/(1-minrate)
497  if total_success_rate_scaled_repr<0:
498  total_success_rate_scaled_repr=0
499  size_s="200x100"
500  if small:
501  size_s="40x30"
502  #print "Total success rate %2.2f and scaled %2.2f "%(total_success_rate,total_success_rate_scaled)
503  gauge_link ="https://chart.googleapis.com/chart?chs=%s&cht=gom"%size_s
504  gauge_link+="&chd=t:%2.1f"%(total_success_rate_scaled_repr*100.)
505  if not small:
506  gauge_link+="&chxt=x,y&chxl=0:|%2.1f%%|1:|%i%%|%i%%|100%%"%(total_success_rate*100,minrate*100.,(1+minrate)*50)
507  gauge_link+="&chma=10,10,10,0"
508  img_tag= '<img src="%s">'%gauge_link
509  if escaped:
510  img_tag=cgi.escape(img_tag)
511  return img_tag
512 
513 #-------------------------------------------------------------------------------
def directories2html.build_obj (   run,
  sample,
  version,
  plot_path,
  tier 
)

Definition at line 55 of file directories2html.py.

References build_obj_addr(), and encode_obj_url().

Referenced by fairy_url().

55 
56 def build_obj(run,sample,version,plot_path,tier):
57  obj_url="obj=%s;" %build_obj_addr(run,sample,version,plot_path,tier)
58  return encode_obj_url(obj_url)
def directories2html.build_obj_addr (   run,
  sample,
  version,
  plot_path,
  tier 
)

Definition at line 45 of file directories2html.py.

Referenced by build_obj(), and fairy_url_single().

45 
46 def build_obj_addr(run,sample,version,plot_path,tier):
47  slash="/"
48  obj_url="archive/%s/%s/%s/%s/" %(run,sample,version,tier)
49  obj_url+=plot_path
50  while obj_url.endswith(slash):
51  obj_url=obj_url[:-1]
52  while slash*2 in obj_url:
53  obj_url=obj_url.replace(slash*2,slash)
54  return obj_url
def directories2html.directory2html (   directory,
  hashing,
  standalone,
  depth = 0 
)
Converts a directory tree into html pages, very nice ones.

Definition at line 431 of file directories2html.py.

References get_comparisons(), get_missing_objs_section(), get_page_footer(), get_page_header(), get_rank_section(), get_subdirs_section(), get_summary_section(), get_title_section(), hash_name(), and join().

432 def directory2html(directory, hashing, standalone, depth=0):
433  """Converts a directory tree into html pages, very nice ones.
434  """
435  #print "d2html: depth", str(depth)," dir ",directory.name
436  depth+=1
437  #old_cwd=getcwd()
438  #if not exists(directory.name) and len(directory.name)>0:
439  #makedirs(directory.name)
440 
441  #if len(directory.name)>0:
442  #chdir(directory.name)
443 
444  for subdir in directory.subdirs:
445  directory2html(subdir,hashing,standalone, depth)
446 
447  page_html=get_page_header(directory, standalone)+\
448  get_title_section(directory,hashing, standalone, depth)+\
449  get_summary_section(directory)+\
450  get_subdirs_section(directory, hashing)
451 
452  for do_cat,cat in ((directory.n_comp_fails >0,FAIL ),
453  (directory.n_comp_nulls >0,NULL ),
454 
455  (directory.n_comp_successes >0 and directory.draw_success,SUCCESS ),
456  (directory.n_comp_skiped >0,SKIPED)):
457  if do_cat:
458  page_html+=get_comparisons(cat,directory)
459 
460  if (len(directory.different_histograms['file1']) >0) or (len(directory.different_histograms['file2']) >0):
461  page_html += get_missing_objs_section(directory)
462 
463  # Distribution of ranks
464 
465  if depth==1:
466  page_html+=get_rank_section(directory)
467 
468 
469  page_html+=get_page_footer()
470 
471  page_name=directory.name
472 
473  if len(page_name)==0:
474  page_name="RelMonSummary"
475  if hashing:
476  if page_name != "RelMonSummary":
477  #print " ## oFile path: %s"%(join(directory.full_path))
478  #print " ## oFile hash: %s"%(hash_name(join(directory.full_path), hashing))
479  ofilename = "%s.html" %(hash_name(join(directory.full_path), hashing)) #as links is generated: parentdi+subdir; we split and get the last parent dir
480  else:
481  ofilename = "RelMonSummary.html"
482  else:
483  ofilename="%s_%s.html" %(directory.mother_dir.replace("/","_"),page_name)
484  ofilename=ofilename.strip("_")
485  #print "Writing on %s" %ofilename
486  ofile=open(ofilename,"w")
487  ofile.write(page_html)
488  ofile.close()
489 
490  #chdir(old_cwd)
491 
492 #-------------------------------------------------------------------------------
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def directories2html.encode_obj_url (   url)

Definition at line 37 of file directories2html.py.

Referenced by build_obj().

37 
38 def encode_obj_url(url):
39  for old,new in url_encode_dict.items():
40  url=url.replace(old,new)
41  return url
def directories2html.fairy_url (   run1,
  run2,
  sample1,
  sample2,
  version1,
  version2,
  plot_path,
  tier1,
  tier2,
  draw_opts = "",
  h = 250,
  w = 200 
)

Definition at line 59 of file directories2html.py.

References build_obj(), and plot_size().

Referenced by get_comparisons().

59 
60 def fairy_url(run1,run2,sample1,sample2,version1,version2,plot_path,tier1,tier2,draw_opts="",h=250,w=200):
61  fairy_url = "%s/%s/plotfairy/overlay?" %(server,base_url)
62  fairy_url+= build_obj(run1,sample1,version1,plot_path,tier1)
63  fairy_url+= build_obj(run2,sample2,version2,plot_path,tier2)
64  if len(draw_opts)>0:
65  fairy_url+="drawopts=%s;" %draw_opts
66  fairy_url+= plot_size(h,w)
67  return fairy_url
def directories2html.fairy_url_single (   run,
  sample,
  version,
  plot_path,
  tier,
  draw_opts = "",
  h = 250,
  w = 200 
)

Definition at line 68 of file directories2html.py.

References build_obj_addr(), and plot_size().

Referenced by get_comparisons().

68 
69 def fairy_url_single(run,sample,version,plot_path,tier,draw_opts="",h=250,w=200):
70  fairy_url = "%s/%s/plotfairy/" %(server,base_url)
71  fairy_url+=build_obj_addr(run,sample,version,plot_path,tier)
72  fairy_url+= "?%s"%plot_size(h,w)
73  if len(draw_opts)>0:
74  fairy_url+="drawopts=%s;" %draw_opts
75  return fairy_url
76 
77 #-------------------------------------------------------------------------------
style_location="/cms-service-reldqm"
def directories2html.get_aggr_pairs_info (   dir_dict,
  the_aggr_pairs = [] 
)

Definition at line 514 of file directories2html.py.

References alcazmumu_cfi.filter, and relativeConstraints.keys.

Referenced by make_barchart_summary(), make_categories_summary(), and make_twiki_table().

515 def get_aggr_pairs_info(dir_dict,the_aggr_pairs=[]):
516  # Let's make a summary for an overview in categories act on the global dir
517  aggr_pairs_info=[]#(name,{directories names:{nsucc: nsucc,weight:weight}},weight,success_rate)
518 
519  list_of_names=[]
520  if the_aggr_pairs==[]:
521  for samplename,sampledir in dir_dict.items():
522  for subsysdirname in sorted(sampledir.get_subdirs_dict().keys()):
523  if not subsysdirname in list_of_names:
524  list_of_names.append(subsysdirname)
525  the_aggr_pairs.append((subsysdirname,[subsysdirname]))
526 
527  #print the_aggr_pairs
528  for cat_name, subdir_list in the_aggr_pairs:
529  total_successes=0.
530  total_directory_successes=0
531  total_weight=0.
532  present_subdirs={}
533  total_ndirs=0
534  # Loop on samples
535  for dirname, sampledir in dir_dict.items():
536  # Loop on directories
537  for subdirname,subdir in sampledir.get_subdirs_dict().items():
538  if subdirname in subdir_list:
539  nsucc=subdir.n_successes
540  total_successes+=nsucc
541  weight=subdir.weight
542  total_weight+=weight
543  total_ndirs+=1
544 
545  total_directory_successes+= float(nsucc)/weight
546  if present_subdirs.has_key(subdirname):
547  this_dir_dict=present_subdirs[subdirname]
548  this_dir_dict["nsucc"]+=nsucc
549  this_dir_dict["weight"]+=weight
550  else:
551  present_subdirs[subdirname]={"nsucc":nsucc,"weight":weight}
552  # Make it usable also for subdirectories
553  for subsubdirname,subsubdir in subdir.get_subdirs_dict().items():
554  for pathname in filter(lambda name:"/" in name,subdir_list):
555  selected_subdirname,selected_subsubdirname = pathname.split("/")
556  if selected_subdirname == subdirname and selected_subsubdirname==subsubdirname:
557  #print "Studying directory ",subsubdirname," in directory ",subdirname
558  nsucc=subsubdir.n_successes
559  total_successes+=nsucc
560  weight=subsubdir.weight
561  total_weight+=weight
562  total_ndirs+=1
563  total_directory_successes+= float(nsucc)/weight
564 
565  if present_subdirs.has_key(subsubdirname):
566  this_dir_dict=present_subdirs[subsubdirname]
567  this_dir_dict["nsucc"]+=nsucc
568  this_dir_dict["weight"]+=weight
569  else:
570  present_subdirs[subsubdirname]={"nsucc":nsucc,"weight":weight}
571 
572  if total_ndirs == 0:
573  print "No directory of the category %s is present in the samples: skipping." %cat_name
574  continue
575 
576  average_success_rate=total_directory_successes/(total_ndirs)
577  aggr_pairs_info.append((cat_name,present_subdirs,total_weight,average_success_rate))
578 
579  return aggr_pairs_info
580 
581 #-------------------------------------------------------------------------------
def directories2html.get_comparisons (   category,
  directory 
)
Prepare the comparisons between histograms and organise them in the page.
Moreover create separate pages with the overlay and the single plots.

Definition at line 281 of file directories2html.py.

References fairy_url(), and fairy_url_single().

Referenced by directory2html().

282 def get_comparisons(category,directory):
283  """Prepare the comparisons between histograms and organise them in the page.
284  Moreover create separate pages with the overlay and the single plots.
285  """
286  counter=1
287  tot_counter=1
288 
289  # get the right ones
290  comparisons= filter (lambda comp: comp.status == cat_states[category] , directory.comparisons)
291  n_comparisons=len(comparisons)
292 
293  is_reverse=True
294  if category == FAIL:
295  is_reverse=False
296  comparisons=sorted(comparisons, key=lambda comp:comp.rank, reverse=is_reverse)
297 
298 
299  dir_abs_path="%s/%s/" %(directory.mother_dir,directory.name)
300  html_comparisons=""
301  for comparison in comparisons:
302  plot_name=comparison.img_name
303  if "http://" not in plot_name:
304  plot_name= basename(comparison.img_name)
305  class_type="colborder"
306  if counter==3 or tot_counter==n_comparisons:
307  class_type=" colborder last"
308  comp_abs_path="%s/%s" %(dir_abs_path,comparison.name)
309 
310 
311  if directory.do_pngs:
312  png_link=comparison.img_name
313  html_comparisons+='<div class="span-6 %s"><p>%s</p>' %(class_type,comparison.name)+\
314  '<p class="alt">%s: %.2E</p>' %(comparison.test_name,comparison.rank)+\
315  '<a href="%s"><img src="%s" width="250" height="200" class="top center %s"></a></div>'%(png_link,png_link,cat_classes[category])
316  else:
317  big_fairy=fairy_url(directory.meta.run1,
318  directory.meta.run2,
319  directory.meta.sample1,
320  directory.meta.sample2,
321  directory.meta.release1,
322  directory.meta.release2,
323  comp_abs_path,
324  directory.meta.tier1,
325  directory.meta.tier2,
326  "",600,600)
327  small_fairy=fairy_url(directory.meta.run1,
328  directory.meta.run2,
329  directory.meta.sample1,
330  directory.meta.sample2,
331  directory.meta.release1,
332  directory.meta.release2,
333  comp_abs_path,
334  directory.meta.tier1,
335  directory.meta.tier2)
336 
337  single_fairy1=fairy_url_single(directory.meta.run1,
338  directory.meta.sample1,
339  directory.meta.release1,
340  comp_abs_path,
341  directory.meta.tier1,
342  "",500,500)
343  single_fairy2=fairy_url_single(directory.meta.run2,
344  directory.meta.sample2,
345  directory.meta.release2,
346  comp_abs_path,
347  directory.meta.tier2,
348  "",500,500)
349 
350  html_comparisons+='<div class="span-6 %s"><p>%s</p>' %(class_type,comparison.name)+\
351  '<p class="alt">%s: %.2E</p>' %(comparison.test_name,comparison.rank)+\
352  '<div><a class="black_link" href="%s">%s</a></div>'%(single_fairy1,directory.meta.release1)+\
353  '<div><a href="%s">%s</a></div>'%(single_fairy2,directory.meta.release2)+\
354  '<a href="%s"><img src="%s" class="top center %s"></a></div>'%(big_fairy,small_fairy,cat_classes[category])
355 
356  if counter==3:
357  html_comparisons+="<hr>"
358  counter=0
359  counter+=1
360  tot_counter+=1
361 
362  if len(html_comparisons)!=0:
363  html='<div class="span-20"><h2 class="alt">%s Comparisons</h2></div>' %cat_names[category]
364  html+=html_comparisons
365  html+='<hr>'
366  return html
367  return ""
368 
369 #-------------------------------------------------------------------------------
def directories2html.get_dir_stats (   directory)

Definition at line 168 of file directories2html.py.

Referenced by get_subdirs_section(), and get_summary_section().

169 def get_dir_stats(directory):
170  html='<p><span class="caps alt">%s comparisons:</span></p>'%directory.weight
171  html+='<ul>'
172  if directory.n_successes>0:
173  html+='<li><span class="caps">Success: %.1f%% (%s)</span></li>'%(directory.get_success_rate(),directory.n_successes)
174  if directory.n_nulls>0:
175  html+='<li><span class="caps">Null: %.1f%% (%s)</span></li>'%(directory.get_null_rate(),directory.n_nulls)
176  if directory.n_fails>0:
177  html+='<li><span class="caps">Fail: %.1f%% (%s)</span></li>'%(directory.get_fail_rate(),directory.n_fails)
178  if directory.n_skiped>0:
179  html+='<li><span class="caps">Skipped: %.1f%% (%s)</span></li>'%(directory.get_skiped_rate(),directory.n_skiped)
180  if directory.n_missing_objs>0:
181  html+='<li><span class="caps">Unpaired: %s</span></li>'%(directory.n_missing_objs)
182  html+='</ul>'
183  return html
184 
185 #-------------------------------------------------------------------------------
def directories2html.get_missing_objs_section (   directory)
Method to get missing objects from directory: in case histogram/directory was in one ROOT file but not in other

Definition at line 418 of file directories2html.py.

Referenced by directory2html().

419 def get_missing_objs_section(directory):
420  """Method to get missing objects from directory: in case histogram/directory was in one ROOT file but not in other
421  """
422  page_html = "Unpaired in %s</br>"%(directory.filename1)
423  for elem in directory.different_histograms['file1']:
424  page_html += "name: %s type:%s </br>"%(elem,directory.different_histograms['file1'][elem])
425  page_html +="</br>"
426  page_html += "Unpaired in %s</br>"%(directory.filename2)
427  for elem in directory.different_histograms['file2']:
428  page_html += "name: %s type:%s </br>"%(elem,directory.different_histograms['file2'][elem])
429  return page_html
430 #-------------------------------------------------------------------------------
def directories2html.get_page_footer ( )

Definition at line 117 of file directories2html.py.

Referenced by directory2html(), and make_summary_table().

118 def get_page_footer():
119  return '</div></body></html>'
120 
121 #-------------------------------------------------------------------------------
def directories2html.get_page_header (   directory = None,
  standalone = False,
  additional_header = "" 
)

Definition at line 78 of file directories2html.py.

Referenced by directory2html(), and make_summary_table().

78 
79 def get_page_header(directory=None, standalone=False, additional_header=""):
80  style_location="/cms-service-reldqm"
81  if standalone:
82  style_location = "http://cms-service-reldqm.web.cern.ch/" + style_location +"/"
83  javascripts=''
84  style=''
85  if directory!=None and len(directory.comparisons)>0:
86  meta=directory.meta
87  style='img.fail {border:1px solid #ff0000;}\n'+\
88  'img.succes {border:1px solid #00ff00;}\n'+\
89  'img.null {border:1px solid #ffff00;}\n'+\
90  'img.skiped {border:1px solid #7a7a7a;}\n'+\
91  'a.black_link:link {color: #333333}\n'+\
92  'a.black_link:hover {color: #737373}\n'+\
93  'a.black_link:visited {color: #333333}\n'+\
94  'a.black_link:active {color: #333333}\n'
95  javascripts=""
96 
97 
98  html='<html>'+\
99  '<head>'+\
100  '<title>RelMon Summary</title>'+\
101  '<link rel="stylesheet" href="%s/style/blueprint/screen.css" type="text/css" media="screen, projection">'%style_location+\
102  '<link rel="stylesheet" href="%s/style/blueprint/print.css" type="text/css" media="print">'%style_location+\
103  '<link rel="stylesheet" href="%s/style/blueprint/plugins/fancy-type/screen.css" type="text/css" media="screen, projection">'%style_location+\
104  '<style type="text/css">'+\
105  '.rotation {display: block;-webkit-transform: rotate(-90deg);-moz-transform: rotate(-90deg); }'+\
106  '%s'%style+\
107  '</style>'+\
108  '%s'%javascripts+\
109  '%s'%additional_header+\
110  '</head>'+\
111  '<body>'+\
112  '<div class="container">'
113 
114  return html
115 
116 #-------------------------------------------------------------------------------
def directories2html.get_pie_tooltip (   directory)

Definition at line 657 of file directories2html.py.

Referenced by make_summary_table().

658 def get_pie_tooltip(directory):
659  tooltip="%s\nS:%2.1f%% N:%2.1f%% F:%2.1f%% Sk:%2.1f%%" %(directory.name,directory.get_success_rate(),directory.get_null_rate(),directory.get_fail_rate(),directory.get_skiped_rate())
660  return tooltip
661 
662 #-------------------------------------------------------------------------------
def directories2html.get_rank_section (   directory)

Definition at line 370 of file directories2html.py.

Referenced by directory2html(), and make_summary_table().

371 def get_rank_section(directory):
372 # do Rank histo png
373  imgname="RankSummary.png"
374  gStyle.SetPadTickY(0)
375  c=TCanvas("ranks","ranks",500,400)
376  #gStyle.SetOptStat(0)
377  c.cd()
378 
379  h=directory.rank_histo
380  rank_histof=TH1F(h.GetName(),"",h.GetNbinsX(),h.GetXaxis().GetXmin(),h.GetXaxis().GetXmax())
381  rank_histof.SetLineWidth(2)
382  for i in xrange(0,h.GetNbinsX()+1):
383  rank_histof.SetBinContent(i,h.GetBinContent(i))
384  h.SetTitle("Ranks Summary;Rank;Frequency")
385  h.Draw("Hist")
386  c.Update()
387  rank_histof.ComputeIntegral()
388  integral = rank_histof.GetIntegral()
389  rank_histof.SetContent(integral)
390 
391  rightmax = 1.1*rank_histof.GetMaximum()
392  scale = gPad.GetUymax()/rightmax
393  rank_histof.SetLineColor(kRed)
394  rank_histof.Scale(scale)
395  rank_histof.Draw("same")
396 
397  #draw an axis on the right side
398  axis = TGaxis(gPad.GetUxmax(),gPad.GetUymin(),gPad.GetUxmax(), gPad.GetUymax(),0,rightmax,510,"+L")
399  axis.SetTitle("Cumulative")
400  axis.SetTitleColor(kRed)
401  axis.SetLineColor(kRed)
402  axis.SetLabelColor(kRed)
403  axis.Draw()
404 
405  rank_histof.Draw("Same");
406 
407 
408  c.Print(imgname)
409 
410  page_html='<div class="span-20"><h2 class="alt"><a name="rank_summary">Ranks Summary</a></h2>'
411  page_html+='<div class="span-19"><img src="%s"></div>' %imgname
412  page_html+='</div> <a href="#top">Top...</a><hr>'
413 
414  return page_html
415 
416 #-------------------------------------------------------------------------------
417 
#-------------------------------------------------------------------------------
def directories2html.get_subdirs_section (   directory,
  hashing_flag 
)

Definition at line 186 of file directories2html.py.

References get_dir_stats(), hash_name(), and join().

Referenced by directory2html().

187 def get_subdirs_section(directory, hashing_flag):
188  if len(directory.subdirs)==0:
189  return ""
190  html= '<div class="span-20 colborder">'
191  html+='<h2 class="alt">Sub-Directories</h2>'
192  # sort subdirs according to the number of fails and number of nulls and then alphabveticaly
193  # so reverse :)
194  sorted_subdirs= sorted(directory.subdirs, key= lambda subdir: subdir.name)
195  sorted_subdirs= sorted(sorted_subdirs, key= lambda subdir: subdir.n_nulls, reverse=True)
196  sorted_subdirs= sorted(sorted_subdirs, key= lambda subdir: subdir.n_fails, reverse=True)
197  for subdir in sorted_subdirs:
198  name=subdir.name
199  if hashing_flag:
200  link = "%s.html" %(hash_name(join(directory.full_path,name), hashing_flag)) #do hash with directory name + subdirname as single name hashing might get problems with same subdirs name in different parent dirs.
201  else:
202  link="%s_%s_%s.html" %(directory.mother_dir.replace("/","_"),directory.name.replace("/","_"),name)
203  link=link.strip("_")
204  html+='<div class="span-4 prepend-2 colborder">'
205  html+='<h3>%s</h3>'%name
206  html+='</div>'
207 
208  html+='<div class="span-7">'
209  html+=get_dir_stats(subdir)
210  html+='</div>'
211 
212  html+='<div class="span-6 last">'
213  html+='<a href="%s"><img src="%s" class="top right"></a>'%(link,subdir.get_summary_chart_ajax(150,100))
214  html+='</div>'
215 
216  html+='<hr>'
217  return html+'</div>'
218 
219 
220 #-------------------------------------------------------------------------------
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def directories2html.get_summary_section (   directory,
  matrix_page = True 
)

Definition at line 221 of file directories2html.py.

References get_dir_stats().

Referenced by directory2html(), and make_summary_table().

222 def get_summary_section(directory,matrix_page=True):
223 
224  # Hack find the first comparison and fill test and threshold
225  # shall this be put in meta?
226  test_name=""
227  test_threshold=0
228  for comparison in directory.comparisons:
229  test_name=comparison.test_name
230  test_threshold=comparison.test_thr
231  break
232  if len(test_name)==0:
233  for subdir in directory.subdirs:
234  for comparison in subdir.comparisons:
235  test_name=comparison.test_name
236  test_threshold=comparison.test_thr
237  break
238  if len(test_name)!=0:break
239  if len(test_name)==0:
240  for subsubdir in subdir.subdirs:
241  for comparison in subsubdir.comparisons:
242  test_name=comparison.test_name
243  test_threshold=comparison.test_thr
244  break
245  if len(test_name)!=0:break
246  if len(test_name)==0:
247  for subsubsubdir in subsubdir.subdirs:
248  for comparison in subsubsubdir.comparisons:
249  test_name=comparison.test_name
250  test_threshold=comparison.test_thr
251  break
252  if len(test_name)!=0:break
253 
254 
255  meta=directory.meta
256 
257  html= '<div class="span-6">'+\
258  '<h3>Summary</h3>'
259  html+=get_dir_stats(directory)
260  html+='<a href="%s/%s">To the DQM GUI...</a>' %(server,base_url)
261  html+='</div>'
262 
263  html+='<div class="span-7 colborder">'+\
264  '<img src="%s" class="top right">'%directory.get_summary_chart_ajax(200,200)+\
265  '</div>'+\
266  '<div class="span-9 last">'
267  if matrix_page:
268  html+='<h3>Sample:</h3>'+\
269  '<p class="caps">%s</p>'%meta.sample1+\
270  '<h3>Run1 and Run2:</h3>'+\
271  '<p class="caps">%s - %s</p>'%(meta.run1,meta.run2)
272  html+='<h3>Releases:</h3>'+\
273  '<ul><li><p>%s</p></li><li><p>%s</p></li></ul>'%(meta.release1,meta.release2)+\
274  '<h3>Statistical Test (Pvalue threshold):</h3>'+\
275  '<ul><li><p class="caps">%s (%s)</p></li></ul>'%(test_name,test_threshold)+\
276  '</div>'+\
277  '<hr>'
278  return html
279 
280 #-------------------------------------------------------------------------------
def directories2html.get_title_section (   directory,
  hashing_flag,
  standalone,
  depth = 2 
)

Definition at line 122 of file directories2html.py.

References hash_name().

Referenced by directory2html().

123 def get_title_section(directory, hashing_flag, standalone, depth=2):
124  if standalone:
125  cms_logo_url = "http://cms-service-reldqm.web.cern.ch/cms-service-reldqm/style/CMS.gif"
126  else:
127  cms_logo_url = "cms-service-reldqm/style/CMS.gif"
128  mother_name=basename(directory.mother_dir)
129  mother_file_name=""
130  if depth==1:
131  mother_file_name="../RelMonSummary.html"
132  if mother_name!="":
133  mother_file_name="%s.html" %(hash_name(mother_name, hashing_flag))
134  elif depth==2:
135  mother_file_name="RelMonSummary.html"
136  #mother_file_name="%s.html" %(hash_name("RelMonSummary", hashing_flag))
137  if mother_name!="":
138  mother_file_name="%s.html" %(hash_name(mother_name, hashing_flag))
139  else:
140  if hashing_flag:
141  files = directory.mother_dir.split("/")
142  if len(files) != 1:
143  dir_name = files[-2]+files[-1] ##return the mother directory name only as the html file name by it
144  else:
145  dir_name = files[-1]
146  dir_name = directory.mother_dir
147  mother_file_name="%s.html" %(hash_name(dir_name, hashing_flag))
148  else:
149  mother_file_name="%s.html" %directory.mother_dir.replace("/","_")
150  mother_file_name=mother_file_name.strip("_")
151 
152  link_to_mother='<a href="%s">..</a>' %mother_file_name
153  html= '<div class="span-20">'+\
154  '<h1>%s</h1>'%directory.name+\
155  '</div>'+\
156  '<div class="span-1">'+\
157  '<h1>%s</h1>'%link_to_mother+\
158  '</div>'+\
159  '<div class="span-3 last">'+\
160  '<img src="%s" class="top right" width="54" hight="54">'%cms_logo_url+\
161  '</div>'+\
162  '<hr>'
163  if len(mother_name)>0:
164  html+='<h2 class="alt">%s</h2>'% directory.mother_dir+\
165  '<hr>'
166  return html
167 
#-------------------------------------------------------------------------------
def directories2html.hash_name (   file_name,
  flag 
)

Definition at line 933 of file directories2html.py.

Referenced by directory2html(), get_subdirs_section(), get_title_section(), and make_summary_table().

934 def hash_name(file_name, flag):
935  #print " HashFILE name: "+file_name
936  if flag: #if hashing flag is ON then return
937  return hashlib.md5(file_name).hexdigest()[:10] #md5 hashed file name with length 10
938  else:
939  return file_name #return standart name
def directories2html.make_barchart_summary (   dir_dict,
  name = "the_chart",
  title = "DQM directory",
  the_aggr_pairs = [] 
)

Definition at line 663 of file directories2html.py.

References get_aggr_pairs_info().

Referenced by make_summary_table().

664 def make_barchart_summary(dir_dict,name="the_chart",title="DQM directory",the_aggr_pairs=[]):
665 
666  aggr_pairs_info= get_aggr_pairs_info(dir_dict,the_aggr_pairs)
667 
668  script="""
669  <script type="text/javascript" src="https://www.google.com/jsapi"></script>
670  <script type="text/javascript">
671  google.load("visualization", "1", {packages:["corechart"]});
672  google.setOnLoadCallback(drawChart);
673  function drawChart() {
674  var data = new google.visualization.DataTable();
675  data.addColumn('string', 'DQM Directory');
676  data.addColumn('number', 'Success Rate');
677  """
678  script+="data.addRows(%i);\n"%len(aggr_pairs_info)
679  counter=0
680  for subsystname,present_directories,weight,success_rate in aggr_pairs_info:
681  #print subsystname,present_directories
682  script+="data.setValue(%i, 0, '%s');\n"%(counter,subsystname)
683  script+="data.setValue(%i, 1, %2.2f);\n"%(counter,success_rate)
684  counter+=1
685  script+="""
686  var chart = new google.visualization.BarChart(document.getElementById('%s'));
687  chart.draw(data, {width: 1024, height: %i, title: 'Success Rate',
688  vAxis: {title: '%s', titleTextStyle: {color: 'red'},textStyle: {fontSize: 14}}
689  });
690  }
691  </script>
692  """%(name,40*counter,title)
693  return script
694 
695 
696 #-------------------------------------------------------------------------------
def directories2html.make_categories_summary (   dir_dict,
  aggregation_rules 
)

Definition at line 582 of file directories2html.py.

References build_gauge(), and get_aggr_pairs_info().

Referenced by make_summary_table().

583 def make_categories_summary(dir_dict,aggregation_rules):
584 
585  aggr_pairs_info= get_aggr_pairs_info(dir_dict,aggregation_rules)
586 
587  #print aggr_pairs_info
588 
589  # Now Let's build the HTML
590 
591  html= '<div class="span-20 colborder">'
592  html+='<h2 class="alt"><a name="categories">Categories:</a></h2>'
593 
594  for cat_name,present_subdirs,total_weight,average_success_rate in aggr_pairs_info:
595  #print cat_name,present_subdirs,total_weight,average_success_rate
596  html+='<div class="span-3 prepend-0 colborder">'
597  html+='<h3>%s</h3>'%cat_name
598  html+='<div><span class="alt">Avg. Success rate:</span></div>'
599  html+='<div><span class="alt">%2.1f%%</span></div>'%(average_success_rate*100)
600  html+='</div>'
601  html+='<div class="span-9">'
602 
603  html+='<div><p><span class="caps alt">DQM Directories (%i comparisons):</span></p></div>' %total_weight
604  html+='<div><p><span class="alt">name: succ. rate - rel. weight</span></p></div>'
605  html+='<ul>'
606  for subdirname in sorted(present_subdirs.keys()):
607  this_dir_dict=present_subdirs[subdirname]
608  nsucc=this_dir_dict["nsucc"]
609  weight=this_dir_dict["weight"]
610  html+='<li><span class="caps">%s: %2.1f%% - %2.1f%%</span></li>'%(subdirname,100*float(nsucc)/weight,100*float(weight)/total_weight)
611  html+='</ul>'
612  html+='</div>'
613 
614  html+='<div class="span-6 last">'
615  html+=build_gauge(average_success_rate)
616  html+='</div>'
617 
618  html+='<hr>'
619  return html+'<br><a href="#top">Top...</a> </div><hr>'
620 
621  #-------------------------------------------------------------------------------
def directories2html.make_summary_table (   indir,
  aggregation_rules,
  aggregation_rules_twiki,
  hashing_flag,
  standalone_flag 
)
Create a table, with as rows the directories and as columns the samples.
Each box in the table will contain a pie chart linking to the directory.

Definition at line 697 of file directories2html.py.

References alcazmumu_cfi.filter, get_page_footer(), get_page_header(), get_pie_tooltip(), get_rank_section(), get_summary_section(), hash_name(), join(), list(), make_barchart_summary(), make_categories_summary(), and make_twiki_table().

Referenced by ValidationMatrix.do_html().

698 def make_summary_table(indir,aggregation_rules,aggregation_rules_twiki, hashing_flag, standalone_flag):
699  """Create a table, with as rows the directories and as columns the samples.
700  Each box in the table will contain a pie chart linking to the directory.
701  """
702  #aggregation_rules={}
703  #aggregation_rules_twiki={}
704 
705  chdir(indir)
706  if os.path.isabs(indir):
707  title = basename(indir)
708  else:
709  title=indir
710  title=title.strip(".")
711  title=title.strip("/")
712 
713 
714  # Get the list of pickles
715  sample_pkls=filter(lambda name: name.endswith(".pkl"),listdir("./"))
716 
717  # Load directories, build a list of all first level subdirs
718  dir_unpicklers=[]
719  n_unpicklers=0
720  for sample_pkl in sample_pkls:
721  dir_unpickler=unpickler(sample_pkl)
722  dir_unpickler.start()
723  n_unpicklers+=1
724  dir_unpicklers.append(dir_unpickler)
725  if n_unpicklers>=1: #pickleing is very expensive. Do not overload cpu
726  n_unpicklers=0
727  for dir_unpickler in dir_unpicklers:
728  dir_unpickler.join()
729 
730  dir_dict={}
731 
732  # create a fake global directory
733  global_dir=Directory("global","")
734  for dir_unpickler in dir_unpicklers:
735  dir_unpickler.join()
736  directory=dir_unpickler.directory
737  #directory.prune("Run summary")
738  #directory.calcStats()
739  global_dir.meta=directory.meta
740  dir_dict[dir_unpickler.filename.replace(".pkl","")]=directory
741  global_dir.subdirs.append(directory)
742 
743  global_dir.calcStats()
744 
745  directories_barchart=make_barchart_summary(dir_dict,'dir_chart',"DQM Directory")
746  categories_barchart=make_barchart_summary(dir_dict,'cat_chart','Category',aggregation_rules)
747 
748  page_html = get_page_header(standalone=standalone_flag, additional_header=directories_barchart+categories_barchart)
749  rel1=""
750  rel2=""
751  try:
752  rel1,rel2=title.split("VS")
753  except:
754  rel1=global_dir.meta.release1.split("-")[0]
755  rel2=global_dir.meta.release2.split("-")[0]
756  global_dir.meta.release1=rel1
757  global_dir.meta.release2=rel2
758 
759  # union of all subdirs names
760  all_subdirs=[]
761  for directory in dir_dict.values():
762  for subdir_name in directory.get_subdirs_names():
763  all_subdirs.append(subdir_name)
764  all_subdirs=sorted(list(set(all_subdirs)))
765 
766  #print " $$ all_subdirs: %s" %(all_subdirs)
767 
768  # Get The title
769  page_html+= '<div class="span-20">'+\
770  '<h2><a name="top" href="https://twiki.cern.ch/twiki/bin/view/CMSPublic/RelMon">RelMon</a> Global Report: %s</h2>'%title+\
771  '</div>'+\
772  '<div class="span-1">'+\
773  '<h2><a href="%s">main...</a></h2>' %relmon_mainpage+\
774  '</div>'+\
775  '<hr>'
776  page_html+='<div class="span-24"><p></p></div>\n'*3
777 
778  # Get The summary section
779  page_html+= get_summary_section(global_dir,False)
780 
781  # Make the anchor sections
782  page_html+= '<div class="span-24">'
783  page_html+= '<div class="span-20 colborder"><h2 class="alt">Sections:</h2>'+\
784  '<ul>'+\
785  '<li><a href="#summary_barchart">Summary Barchart</a></li>'+\
786  '<li><a href="#categories">Categories</a></li>'+\
787  '<li><a href="#detailed_barchart">Detailed Barchart</a></li>'+\
788  '<li><a href="#summary_table">Summary Table</a></li>'+\
789  '<li><a href="#rank_summary">Ranks Summary</a></li>'+\
790  '<li><a href="#twiki_table">Twiki Table</a></li>'+\
791  '</ul>'+\
792  '</div><hr>'
793 
794 
795  # Make the CategoriesBar chart
796  page_html+='<div class="span-24"><h2 class="alt"><a name="summary_barchart">Summary Barchart</a></h2></div>'
797  page_html+='<div id="cat_chart"></div> <a href="#top">Top...</a><hr>'
798 
799  # Make the gauges per categories
800  page_html+=make_categories_summary(dir_dict,aggregation_rules)
801 
802  # Make the Directories chart
803  page_html+='<div class="span-24"><h2 class="alt"><a name="detailed_barchart">Detailed Barchart</a></h2></div>'
804  page_html+='<div id="dir_chart"></div> <a href="#top">Top...</a><hr>'
805 
806  # Barbarian vertical space. Suggestions are welcome
807  for i in xrange(2):
808  page_html+='<div class="span-24"><p></p></div>\n'
809 
810 
811  # Prepare the table
812  page_html+='<div class="span-24"><h2 class="alt"><a name="summary_table">Summary Table</a></h2></div>'
813 
814  for i in xrange(5):
815  page_html+='<div class="span-24"><p></p></div>\n'
816 
817  page_html+="""
818  <table border="1" >
819  <tr>
820  <td> </td>
821  """
822 
823  # First row with samples
824  page_html+="""
825  <td><div class="span-1"><p class="rotation" style="alt"><b>Summary</b></p></div></td>"""
826 
827  sorted_samples=sorted(dir_dict.keys())
828  for sample in sorted_samples:
829  sample_nick=sample
830  ## For runs: put only the number after the _
831  #if "_" in sample:
832  #run_number=sample.split("_")[-1]
833  #if (not run_number.isalpha()) and len(run_number)>=6:
834  #sample_nick=run_number
835 
836 
837  page_html+="""
838  <td><div class="span-1"><p class="rotation" style="">%s</p></div></td>"""%sample_nick
839  page_html+=" </tr>\n"
840 
841 
842  # FIRST ROW
843  # Now the summaries at the beginning of the table
844  page_html+="<tr>"
845  page_html+='<td style="background-color:white;"><div class="span-1">'
846 
847  page_html+='<b>Summary</b></div></td>'
848  page_html+='<td style="background-color:white;" class = "colborder" ><div class="span-1"><img src="%s" alt="%s"></div></td>'%(global_dir.get_summary_chart_ajax(55,55),get_pie_tooltip(global_dir))
849  for sample in sorted_samples:
850  col=dir_dict[sample]
851  # check if the directory was a top one or not
852  summary_page_name="RelMonSummary.html"
853  if col.name!="":
854  summary_page_name=hash_name(col.name, hashing_flag)+".html"
855  img_link=col.get_summary_chart_ajax(55,55)
856  page_html+='<td style="background-color:white;"><div class="span-1">'
857  page_html+='<a href="%s/%s"><img src="%s" title="%s"></a></div></td>' %(sample,summary_page_name,img_link,get_pie_tooltip(col))
858  page_html+="</tr>"
859 
860  # Now the content
861  for subdir_name in all_subdirs:
862 
863  page_html+=' <tr>\n'
864  page_html+=' <td style="background-color:white;">%s</td>\n' %subdir_name
865 
866  row_summary=Directory("row_summary","")
867  sample_counter=0
868  n_samples=len(sorted_samples)
869 
870  for sample in sorted_samples:
871  subdirs_dict=directory.get_subdirs_dict()
872  directory=dir_dict[sample]
873  dir_is_there=subdirs_dict.has_key(subdir_name)
874  if dir_is_there:
875  row_summary.subdirs.append(subdirs_dict[subdir_name])
876 
877  # one first row for the summary!
878  row_summary.calcStats()
879  img_link=row_summary.get_summary_chart_ajax(55,55)
880  page_html+='<td style="background-color:white;"><div class="span-1">'
881  page_html+='<img src="%s" title="%s"></div></td>' %(img_link,get_pie_tooltip(row_summary))
882 
883  for sample in sorted_samples:
884  sample_counter+=1
885 
886  directory=dir_dict[sample]
887  subdirs_dict=directory.get_subdirs_dict()
888 
889  # Check if the directory is the top one
890  if directory.name!="":
891  # We did not run on the topdir
892  #print " ## summary_page: %s"%(directory.name+"_"+subdir_name)
893  #print " ## summary_page hash: %s" %(hash_name(directory.name+"/"+subdir_name,hashing_flag))
894  if hashing_flag:
895  summary_page=join(sample,"%s.html"%(hash_name(directory.name+"/"+subdir_name,hashing_flag)))
896  else:
897  summary_page=join(sample,"%s.html"%(hash_name(directory.name+"_"+subdir_name,hashing_flag)))
898  else:
899  #print " ## summary_page: %s"%(directory.name+subdir_name)
900  #print " ## summary_page hash: %s" %(hash_name(directory.name+subdir_name,hashing_flag))
901  summary_page=join(sample,"%s.html"%(hash_name(directory.name+subdir_name,hashing_flag)))
902  dir_is_there=subdirs_dict.has_key(subdir_name)
903 
904  img_link="https://chart.googleapis.com/chart?cht=p3&chco=C0C0C0&chs=50x50&chd=t:1"
905  img_tooltip="N/A"
906  if dir_is_there:
907  #row_summary.subdirs.append(subdirs_dict[subdir_name])
908  img_link=subdirs_dict[subdir_name].get_summary_chart_ajax(50,50)
909  img_tooltip=get_pie_tooltip(subdirs_dict[subdir_name])
910 
911  page_html+='<td style="background-color:white;"><div class="span-1">'
912  if dir_is_there:
913  page_html+='<a href="%s">'%(summary_page)
914  page_html+='<img src="%s" title="%s" height=50 width=50>' %(img_link,img_tooltip)
915  if dir_is_there:
916  page_html+='</a>'
917  page_html+='</div></td>'
918 
919  page_html+=" </tr>\n"
920 
921 
922 
923  page_html+='</table> <a href="#top">Top...</a><hr>'
924 
925  page_html+=get_rank_section(global_dir)
926 
927  page_html+=make_twiki_table(dir_dict,aggregation_rules_twiki)
928 
929  page_html+=get_page_footer()
930  return page_html
931 
932 
#-----------UPDATES------
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
def directories2html.make_twiki_table (   dir_dict,
  aggregation_rules 
)

Definition at line 622 of file directories2html.py.

References build_gauge(), get_aggr_pairs_info(), and split.

Referenced by make_summary_table().

623 def make_twiki_table(dir_dict,aggregation_rules):
624 
625  # decide the release
626  meta= dir_dict.items()[0][1].meta
627  releases=sorted([meta.release1,meta.release2])
628  latest_release=releases[1].split("-")[0]
629 
630 
631  aggr_pairs_info= get_aggr_pairs_info(dir_dict,aggregation_rules)
632 
633  # Now Let's build the HTML
634 
635  html= '<div class="span-20 colborder">'
636  html+='<h2 class="alt"><a name="twiki_table">Twiki snipppet for release managers</a></h2>'
637  html+='<div>| Release | Comparison |'
638  for cat_name,present_subdirs,total_weight,average_success_rate in aggr_pairs_info:
639  html+=cat_name
640  html+=" | "
641  html+='</div>'
642 
643  html+='<div>| %s | %%ICON{arrowdot}%% | '%latest_release
644 
645  # Now add all the line with small gauges
646 
647  for cat_name,present_subdirs,total_weight,average_success_rate in aggr_pairs_info:
648  #print cat_name,present_subdirs,total_weight,average_success_rate
649  html+=build_gauge(average_success_rate,small=True,escaped=True)
650  html+=" | "
651 
652  html+='</div> <a href="#top">Top...</a>'
653  html+='<hr>'
654  return html+'</div>'
655 
656 #-------------------------------------------------------------------------------
double split
Definition: MVATrainer.cc:139
def directories2html.plot_size (   h = 250,
  w = 200 
)

Definition at line 42 of file directories2html.py.

Referenced by fairy_url(), and fairy_url_single().

42 
43 def plot_size(h=250,w=200):
44  return "w=%s;h=%s" %(h,w)

Variable Documentation

directories2html.theargv = sys.argv

Definition at line 19 of file directories2html.py.