@@ -221,11 +221,35 @@ def psql_insert_stability(self, data):
221
221
stability ["pass_cur" ], stability ["fail_cur" ], stability ["passing" ], now )).decode ('utf-8' ) +
222
222
self .psql_stability_selector (cur , data , row ))
223
223
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
+
224
247
def insert_real (self , remote , run ):
225
248
data = run .copy ()
226
249
data ["remote" ] = remote ["name" ]
227
250
228
251
self .psql_insert_stability (data )
252
+ self .psql_insert_device (data )
229
253
230
254
with self .psql_conn .cursor () as cur :
231
255
if not self .psql_has_wip (remote , run ):
0 commit comments