Skip to content

Commit 8e2d457

Browse files
committed
contest: collector: record device info into a table
Store device info in a table, for ease of reporting the driver name in the UI. Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e152031 commit 8e2d457

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

contest/results-collector.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,35 @@ def psql_insert_stability(self, data):
221221
stability["pass_cur"], stability["fail_cur"], stability["passing"], now)).decode('utf-8') +
222222
self.psql_stability_selector(cur, data, row))
223223

224+
def psql_insert_device(self, data):
225+
if 'device' not in data:
226+
return
227+
228+
with self.psql_conn.cursor() as cur:
229+
cur.execute(f"SELECT info FROM devices_info WHERE " +
230+
cur.mogrify("remote = %s AND executor = %s",
231+
(data["remote"], data["executor"], )).decode('utf-8') +
232+
"ORDER BY changed DESC LIMIT 1")
233+
rows = cur.fetchall()
234+
if rows:
235+
info = rows[0][0]
236+
else:
237+
info = 'x'
238+
if info == data['device']:
239+
return
240+
241+
with self.psql_conn.cursor() as cur:
242+
cur.execute(f"INSERT INTO devices_info (remote, executor, changed, info) " +
243+
cur.mogrify("VALUES(%s, %s, %s, %s)",
244+
(data["remote"], data["executor"],
245+
data["start"], data["device"])).decode('utf-8'))
246+
224247
def insert_real(self, remote, run):
225248
data = run.copy()
226249
data["remote"] = remote["name"]
227250

228251
self.psql_insert_stability(data)
252+
self.psql_insert_device(data)
229253

230254
with self.psql_conn.cursor() as cur:
231255
if not self.psql_has_wip(remote, run):

deploy/contest/db

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,11 @@ CREATE TABLE stability (
8585
last_update timestamp,
8686
passing timestamp
8787
);
88+
89+
90+
CREATE TABLE devices_info (
91+
remote varchar(80),
92+
executor varchar(80),
93+
changed timestamp,
94+
info text
95+
);

0 commit comments

Comments
 (0)