summaryrefslogtreecommitdiffstats
path: root/scripts/getrankings.py
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2011-02-18 10:14:09 +0100
committerjasplin <qt-info@nokia.com>2011-02-18 10:14:09 +0100
commit425f54886ded0acc7a256921d51059509c46045b (patch)
treec523fdd8157e3a77c207e8c1b22df700789a31b8 /scripts/getrankings.py
parentbcd85891292428e53a67f00a0ceb005c48ee877a (diff)
Added basic annotation.
On the rankings page, a note for an individual benchmark can now be edited. This is the first step towards a more sophisticated annotation concept. It could for example be useful to interactively classify a benchmark as "suspended" or "active".
Diffstat (limited to 'scripts/getrankings.py')
-rw-r--r--scripts/getrankings.py31
1 files changed, 26 insertions, 5 deletions
diff --git a/scripts/getrankings.py b/scripts/getrankings.py
index 1ed2f3b..d1106f8 100644
--- a/scripts/getrankings.py
+++ b/scripts/getrankings.py
@@ -59,6 +59,17 @@ class GetRankings:
rankings = {}
context_ids = set([self.context2_id]) # Affected context IDs
+
+ # Get all time series notes:
+ qres = execQuery(
+ "SELECT benchmarkId, metricId, note FROM timeSeriesAnnotation"
+ " WHERE hostId = %d AND platformId = %d AND branchId = %d"
+ % (self.host_id, self.platform_id, self.branch_id))
+ notes = {}
+ for benchmark_id, metric_id, note in qres:
+ notes[benchmark_id, metric_id] = note
+
+
# Get rankings for each statistic:
stat_infos = execQuery("SELECT id, value FROM rankingStat;")
for stat_id, stat_name in stat_infos:
@@ -74,7 +85,7 @@ class GetRankings:
ranking = []
- # Apply test case filter:
+ # Apply test case filter and add notes:
for row in ranking_all:
benchmark_id = row[0]
benchmark = idToText("benchmark", benchmark_id)
@@ -82,7 +93,17 @@ class GetRankings:
benchmarkToComponents(benchmark))
if ((self.test_case_filter == None)
or (test_case in self.test_case_filter)):
- ranking.append(row)
+
+ # Append note if any:
+ metric_id = row[1]
+ try:
+ note = notes[benchmark_id, metric_id]
+ except KeyError:
+ note = ""
+
+ ranking.append((
+ benchmark_id, metric_id, row[2], row[3], row[4],
+ row[5], note))
for row in ranking:
@@ -112,9 +133,9 @@ class GetRankings:
ranking = []
for (benchmark_id, metric_id, context1_id, pos, value,
- lc_timestamp) in ranking_without_deltas:
+ lc_timestamp, note) in ranking_without_deltas:
row = [benchmark_id, metric_id, context1_id, pos, value,
- lc_timestamp]
+ lc_timestamp, note]
if pos >= 0:
pos_prev = ranking_prev[benchmark_id, metric_id]
if pos_prev >= 0:
@@ -185,7 +206,7 @@ class GetRankings:
'snapshots': map(
lambda s: (idToText("sha1", s[0]), s[1]), self.snapshots),
'rankings': self.rankings
- }, sys.stdout, indent=4)
+ }, sys.stdout)
class GetRankingsAsJSON(GetRankings):