@@ -1163,26 +1163,26 @@ def progress_reporter(test_id, token):
1163
1163
1164
1164
if 'type' in request .form :
1165
1165
if request .form ['type' ] == 'progress' :
1166
- log .info ('[PROGRESS_REPORTER] Progress reported' )
1166
+ log .info (f '[PROGRESS_REPORTER][Test: { test_id } ] Progress reported' )
1167
1167
if not progress_type_request (log , test , test_id , request ):
1168
1168
return "FAIL"
1169
1169
1170
1170
elif request .form ['type' ] == 'equality' :
1171
- log .info ('[PROGRESS_REPORTER] Equality reported' )
1171
+ log .info (f '[PROGRESS_REPORTER][Test: { test_id } ] Equality reported' )
1172
1172
equality_type_request (log , test_id , test , request )
1173
1173
1174
1174
elif request .form ['type' ] == 'logupload' :
1175
- log .info ('[PROGRESS_REPORTER] Log upload' )
1175
+ log .info (f '[PROGRESS_REPORTER][Test: { test_id } ] Log upload' )
1176
1176
if not upload_log_type_request (log , test_id , repo_folder , test , request ):
1177
1177
return "EMPTY"
1178
1178
1179
1179
elif request .form ['type' ] == 'upload' :
1180
- log .info ('[PROGRESS_REPORTER] File upload' )
1180
+ log .info (f '[PROGRESS_REPORTER][Test: { test_id } ] File upload' )
1181
1181
if not upload_type_request (log , test_id , repo_folder , test , request ):
1182
1182
return "EMPTY"
1183
1183
1184
1184
elif request .form ['type' ] == 'finish' :
1185
- log .info ('[PROGRESS_REPORTER] Test finished' )
1185
+ log .info (f '[PROGRESS_REPORTER][Test: { test_id } ] Test finished' )
1186
1186
finish_type_request (log , test_id , test , request )
1187
1187
else :
1188
1188
return "FAIL"
@@ -1224,7 +1224,7 @@ def progress_type_request(log, test, test_id, request) -> bool:
1224
1224
gcp_instance_entry = GcpInstance .query .filter (GcpInstance .test_id == test_id ).first ()
1225
1225
1226
1226
if status == TestStatus .testing :
1227
- log .info ('test preparation finished' )
1227
+ log .info (f'[Test: { test_id } ] Preparation finished' )
1228
1228
prep_finish_time = datetime .datetime .now ()
1229
1229
# save preparation finish time
1230
1230
gcp_instance_entry .timestamp_prep_finished = prep_finish_time
@@ -1253,21 +1253,12 @@ def progress_type_request(log, test, test_id, request) -> bool:
1253
1253
1254
1254
# If status is complete, remove the GCP Instance entry
1255
1255
if status in [TestStatus .completed , TestStatus .canceled ]:
1256
- log .debug (f"Test { test_id } has been { status } " )
1256
+ log .debug (f"[ Test: { test_id } ] Test { status } " )
1257
1257
var_average = 'average_time_' + test .platform .value
1258
1258
current_average = GeneralData .query .filter (GeneralData .key == var_average ).first ()
1259
1259
average_time = 0
1260
1260
total_time = 0
1261
1261
1262
- # Delete the current instance
1263
- from run import config
1264
- compute = get_compute_service_object ()
1265
- zone = config .get ('ZONE' , '' )
1266
- project = config .get ('PROJECT_NAME' , '' )
1267
- vm_name = f"{ test .platform .value } -{ test .id } "
1268
- operation = delete_instance (compute , project , zone , vm_name )
1269
- wait_for_operation (compute , project , zone , operation ['name' ])
1270
-
1271
1262
if current_average is None :
1272
1263
platform_tests = g .db .query (Test .id ).filter (Test .platform == test .platform ).subquery ()
1273
1264
finished_tests = g .db .query (TestProgress .test_id ).filter (
@@ -1290,8 +1281,8 @@ def progress_type_request(log, test, test_id, request) -> bool:
1290
1281
1291
1282
for p in times :
1292
1283
parts = p .time .split (',' )
1293
- start = datetime .datetime .strptime (parts [0 ], '%Y-%m-%d %H:%M:%S' )
1294
- end = datetime .datetime .strptime (parts [- 1 ], '%Y-%m-%d %H:%M:%S' )
1284
+ start = datetime .datetime .strptime (parts [0 ], '%Y-%m-%d %H:%M:%S.%f ' )
1285
+ end = datetime .datetime .strptime (parts [- 1 ], '%Y-%m-%d %H:%M:%S.%f ' )
1295
1286
total_time += int ((end - start ).total_seconds ())
1296
1287
1297
1288
if len (times ) != 0 :
@@ -1326,7 +1317,7 @@ def progress_type_request(log, test, test_id, request) -> bool:
1326
1317
gcp_instance = GcpInstance .query .filter (GcpInstance .test_id == test_id ).first ()
1327
1318
1328
1319
if gcp_instance is not None :
1329
- log .debug ("Removing GCP Instance entry" )
1320
+ log .debug (f "Removing GCP Instance entry: { gcp_instance } " )
1330
1321
g .db .delete (gcp_instance )
1331
1322
g .db .commit ()
1332
1323
@@ -1360,7 +1351,7 @@ def progress_type_request(log, test, test_id, request) -> bool:
1360
1351
TestResultFile .got .isnot (None )
1361
1352
)
1362
1353
).scalar ()
1363
- log .debug (f'Test { test .id } completed: { crashes } crashes, { results } results' )
1354
+ log .debug (f'[ Test: { test .id } ] Test completed: { crashes } crashes, { results } results' )
1364
1355
if crashes > 0 or results > 0 :
1365
1356
state = Status .FAILURE
1366
1357
message = 'Not all tests completed successfully, please check'
@@ -1381,6 +1372,16 @@ def progress_type_request(log, test, test_id, request) -> bool:
1381
1372
except GithubException as a :
1382
1373
log .error (f'Got an exception while posting to GitHub! Message: { a .data } ' )
1383
1374
1375
+ if status in [TestStatus .completed , TestStatus .canceled ]:
1376
+ # Delete the current instance
1377
+ from run import config
1378
+ compute = get_compute_service_object ()
1379
+ zone = config .get ('ZONE' , '' )
1380
+ project = config .get ('PROJECT_NAME' , '' )
1381
+ vm_name = f"{ test .platform .value } -{ test .id } "
1382
+ operation = delete_instance (compute , project , zone , vm_name )
1383
+ wait_for_operation (compute , project , zone , operation ['name' ])
1384
+
1384
1385
return True
1385
1386
1386
1387
0 commit comments