1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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()
|