summaryrefslogtreecommitdiffstats
path: root/scripts/getnamemappings.py
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2011-05-26 15:07:14 +0200
committerjasplin <qt-info@nokia.com>2011-05-26 15:07:14 +0200
commitcac600fc0a2069e34036c5112ba4cfb8483bb559 (patch)
tree8fba1a4e47113b902582cc6c5f03af909b6e9e73 /scripts/getnamemappings.py
parenteae8ff839296559a637ff100d7585562d68b5cb1 (diff)
Added Top Changes page to replace ranking feature.
This commit introduces the Top Changes page. This page retrieves 'top 10' changes for all host/platform/branch combinations from a new 'change' database table. The script that updates this table for a given host/platform/branch combination is run automatically after uploading a new set of results (since this is when new changes may potentially arise). This commit also removes the ranking feature as this is obsoleted (more or less) by the new feature.
Diffstat (limited to 'scripts/getnamemappings.py')
-rw-r--r--scripts/getnamemappings.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/getnamemappings.py b/scripts/getnamemappings.py
new file mode 100644
index 0000000..2768449
--- /dev/null
+++ b/scripts/getnamemappings.py
@@ -0,0 +1,34 @@
+import sys, json
+from dbaccess import execQuery
+from misc import printJSONHeader
+
+
+class GetNameMappings:
+
+ def __init__(self):
+ pass
+
+ def execute(self):
+ self.hosts = dict(execQuery("SELECT id, value FROM host", ()))
+ self.platforms = dict(execQuery("SELECT id, value FROM platform", ()))
+ self.branches = dict(execQuery("SELECT id, value FROM branch", ()))
+ self.sha1s = dict(execQuery("SELECT id, value FROM sha1", ()))
+ self.benchmarks = dict(execQuery("SELECT id, value FROM benchmark", ()))
+ self.metrics = dict(execQuery("SELECT id, value FROM metric", ()))
+ self.writeOutput()
+
+ def writeOutputAsJSON(self):
+ printJSONHeader()
+ json.dump({
+ 'hosts': self.hosts,
+ 'platforms': self.platforms,
+ 'branches': self.branches,
+ 'sha1s': self.sha1s,
+ 'benchmarks': self.benchmarks,
+ 'metrics': self.metrics
+ }, sys.stdout)
+
+
+class GetNameMappingsAsJSON(GetNameMappings):
+ def writeOutput(self):
+ self.writeOutputAsJSON()