Functions
ViewHighcharts Namespace Reference

Functions

def LineChartTimeSeries (series, data, labels, hook, title="", subtitle="", x_title="Date", y_title="y", colours=False, ordinal_x_axis=False)
 
def ColumnChartTimeSeries (series, data, labels, hook, title="", subtitle="", x_title="Date", y_title="y", colours=False)
 
def dataToSeries (names, data, label, colour=False, dates=True)
 
def testSummary (wildcard, tagged_release=False)
 

Function Documentation

def ViewHighcharts.ColumnChartTimeSeries (   series,
  data,
  labels,
  hook,
  title = "",
  subtitle = "",
  x_title = "Date",
  y_title = "y",
  colours = False 
)

Definition at line 27 of file ViewHighcharts.py.

References dataToSeries(), and open().

27 def ColumnChartTimeSeries(series,data,labels,hook,title="",subtitle="",x_title="Date",y_title="y",colours=False):
28  base = open("%s/web/templates/template_highchart_column.html"%os.environ["NOVAPRODVALID_DIR"]).read()
29  base = base.replace("DOM_HOOK",hook)
30  base = base.replace("SUBTITLE",subtitle)
31  base = base.replace("TITLE",title)
32  base = base.replace("X_LABEL",x_title)
33  base = base.replace("Y_LABEL",y_title)
34  assert len(labels) == len(data),"vhc : The number of labels supplied: %i did not match the number of data series: %i"%(len(data),len(labels))
35 
36  for i,data_series in enumerate(data):
37  if colours: colour = colours[i]
38  else: colour = False
39  series_html = dataToSeries(series,data_series,labels[i],colour=colour,dates=False)
40  base = base.replace("SERIES","%s,SERIES"%series_html)
41 
42  for name in series:
43  base = base.replace("ENTRY",'"%s",ENTRY'%name)
44 
45  base = base.replace("SERIES","")
46  base = base.replace(",ENTRY","")
47  return base
48 
def ColumnChartTimeSeries(series, data, labels, hook, title="", subtitle="", x_title="Date", y_title="y", colours=False)
def dataToSeries(names, data, label, colour=False, dates=True)
procfile open("FD_BRL_v0.txt")
def ViewHighcharts.dataToSeries (   names,
  data,
  label,
  colour = False,
  dates = True 
)

Definition at line 50 of file ViewHighcharts.py.

References cet::sqlite.max().

Referenced by ColumnChartTimeSeries(), and LineChartTimeSeries().

50 def dataToSeries(names,data,label,colour=False,dates=True):
51  series_html = \
52  """
53  {
54  name: '%s',
55  data: [ POINT ],
56  COLOUR
57  }
58  """%label
59  for i,datum in enumerate(data):
60  # if dates[i] < datetime.datetime(2014,6,6): continue
61  if dates: point = "[Date.UTC(%i, %i, %i, %i, %i), %.2f]"%(names[i].year, (names[i].month-1), names[i].day, names[i].hour, names[i].minute, datum)
62  else: point = "%i"%max(0,datum)
63  series_html = series_html.replace("POINT","%s,POINT"%point)
64  if colour: series_html = series_html.replace("COLOUR","color: '%s',"%colour)
65  series_html = series_html.replace("POINT","")
66  series_html = series_html.replace("COLOUR","")
67  return series_html
68 
def dataToSeries(names, data, label, colour=False, dates=True)
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
def ViewHighcharts.LineChartTimeSeries (   series,
  data,
  labels,
  hook,
  title = "",
  subtitle = "",
  x_title = "Date",
  y_title = "y",
  colours = False,
  ordinal_x_axis = False 
)

Definition at line 1 of file ViewHighcharts.py.

References dataToSeries(), and open().

Referenced by testSummary().

1 def LineChartTimeSeries(series,data,labels,hook,title="",subtitle="",x_title="Date",y_title="y",colours=False,ordinal_x_axis=False):
2  import os
3  base = open("%s/web/templates/template_highchart_timeseries.html"%os.environ["NOVAPRODVALID_DIR"]).read()
4  base = base.replace("DOM_HOOK",hook)
5  base = base.replace("SUBTITLE",subtitle)
6  base = base.replace("TITLE",title)
7  base = base.replace("X_LABEL",x_title)
8  base = base.replace("Y_LABEL",y_title)
9  assert len(labels) == len(data),"vhc : The number of labels supplied: %i did not match the number of data series: %i"%(len(data),len(labels))
10 
11  for i,data_series in enumerate(data):
12  if colours: colour = colours[i]
13  else: colour = False
14  series_html = dataToSeries(series,data_series,labels[i],colour=colour,dates=(not ordinal_x_axis))
15  base = base.replace("SERIES","%s,SERIES"%series_html)
16 
17  if ordinal_x_axis:
18  base = base.replace("type: 'datetime',","categories: [ ENTRY ],")
19  base = base.replace("+ Highcharts.dateFormat('%A, %b %e %Y, %H:%M', this.x) +","+ this.x +")
20  for name in series:
21  base = base.replace("ENTRY",'"%s",ENTRY'%name)
22  base = base.replace(",ENTRY","")
23 
24  base = base.replace("SERIES","")
25  return base
26 
def LineChartTimeSeries(series, data, labels, hook, title="", subtitle="", x_title="Date", y_title="y", colours=False, ordinal_x_axis=False)
def dataToSeries(names, data, label, colour=False, dates=True)
procfile open("FD_BRL_v0.txt")
def ViewHighcharts.testSummary (   wildcard,
  tagged_release = False 
)

Definition at line 69 of file ViewHighcharts.py.

References LineChartTimeSeries(), and open().

69 def testSummary(wildcard, tagged_release=False):
70  from glob import glob
71  import ProductionTestTools as tools
72 
73  test_pages = glob("/nusoft/app/web/htdoc/nova/production/testing/%s*/index.html"%wildcard)
74  test_pages.sort()
75  # if options.verbose:
76  # print "run : Found %i pages"%(len(test_pages))
77  # for t in test_pages: print "run : %s"%(t.split("/")[-2])
78  series = []
79  oks = []
80  cogs = []
81  flags = []
82  wrenches = []
83  removes = []
84  floppy_removes = []
85  sends = []
86  for test_page in test_pages:
87  folder_name = test_page.split("/")[-2]
88  if tagged_release:
89  name = tools.releaseFromFolder(folder_name)
90  else:
91  name = tools.folderNameToDateTime(folder_name,tagged_release=tagged_release)
92  if name in series:
93  index = series.index(name)
94  else:
95  series.append(0)
96  oks.append(0)
97  cogs.append(0)
98  flags.append(0)
99  wrenches.append(0)
100  removes.append(0)
101  floppy_removes.append(0)
102  sends.append(0)
103  index = len(series)-1
104  html = open(test_page,"r").read()
105 
106  series[index] = name
107  oks[index] += (html.count("glyphicon glyphicon-ok") - 1) # job ended successfully
108  cogs[index] += (html.count("glyphicon glyphicon-cog") - 2) # job ongoing (there is a second one of these in the navbar, hence -2)
109  flags[index] += (html.count("glyphicon glyphicon-flag") - 1) # STDERR not empty
110  wrenches[index] += (html.count("glyphicon glyphicon-wrench") - 1) # job was killed by batch robots
111  removes[index] += (html.count("glyphicon glyphicon-remove") - 1) # error in run tier
112  floppy_removes[index] += (html.count("glyphicon glyphicon-floppy-remove") - 1) # no pkl file for a completed chain
113  sends[index] += (html.count("glyphicon glyphicon-send") - 1) # failed batch submission
114 
115  if tagged_release:
116  ordinal_x_axis = True
117  x_title = "Release"
118  else:
119  ordinal_x_axis = False
120  x_title = "Date"
121  # timeseries = ColumnChartTimeSeries(series,
122  # [oks,cogs,flags,wrenches,removes,floppy_removes],
123  # ["Ended","Ongoing","STDERR not empty","Killed by batch robots","Error","No output"],
124  # "%stimeseries"%wildcard,title="",y_title="Count",colours=["#99D5C9","#484848","#FCDC4D","#CB793A","#9A031E","#5F0F40"])
125 
126  # else:
127  timeseries = LineChartTimeSeries(series,
128  [oks,cogs,flags,wrenches,removes,floppy_removes,sends],
129  ["Ended","Ongoing","STDERR not empty","Killed by batch robots","Error","No output","Submission failed"],
130  "%stimeseries"%wildcard,title="",y_title="Count",colours=["#99D5C9","#484848","#FCDC4D","#CB793A","#9A031E","#5F0F40","#800080"],
131  ordinal_x_axis=ordinal_x_axis,x_title=x_title)
132 
133  body_html = \
134  """
135  <div class="row">
136  <div class="col-md-12" id="%stimeseries"></div>
137  </div>
138  """%wildcard
139  return body_html,timeseries
def LineChartTimeSeries(series, data, labels, hook, title="", subtitle="", x_title="Date", y_title="y", colours=False, ordinal_x_axis=False)
def testSummary(wildcard, tagged_release=False)
procfile open("FD_BRL_v0.txt")