@@ -1260,7 +1260,6 @@ def get_deployment_status(
1260
1260
An Aqua deployment instance.
1261
1261
"""
1262
1262
ocid = get_ocid_substring (model_deployment_id , key_len = 8 )
1263
- status_list : List [str ] = []
1264
1263
1265
1264
data_science_work_request : DataScienceWorkRequest = DataScienceWorkRequest (
1266
1265
work_request_id
@@ -1272,99 +1271,45 @@ def get_deployment_status(
1272
1271
max_wait_time = DEFAULT_WAIT_TIME ,
1273
1272
poll_interval = DEFAULT_POLL_INTERVAL ,
1274
1273
)
1274
+ except Exception as e :
1275
+ status = ""
1275
1276
predict_logs = deployment .tail_logs ("predict" )
1276
1277
access_logs = deployment .tail_logs ("access" )
1277
-
1278
- status = ""
1279
1278
if access_logs and len (access_logs ) > 0 :
1280
- print ("access log list ############################" )
1281
- print (access_logs )
1282
1279
status = access_logs [0 ]["message" ]
1283
1280
1284
1281
if predict_logs and len (predict_logs ) > 0 :
1285
- print ("predict_logs ############################" )
1286
- print (predict_logs )
1287
1282
status += predict_logs [0 ]["message" ]
1283
+ status = re .sub (r"[^a-zA-Z0-9]" , " " , status )
1288
1284
1289
- status = re .sub (r"[^a-zA-Z0-9]" , "" , status )
1290
- telemetry_kwargs = {
1291
- "ocid" : ocid ,
1292
- "model_name" : model_name ,
1293
- "status" : status ,
1294
- }
1295
- print (telemetry_kwargs )
1296
- print ("############################" )
1297
-
1298
- self .telemetry .record_event (
1299
- category = f"aqua/{ model_type } /deployment/status" ,
1300
- action = "LAST_LOG" ,
1301
- # detail=error_str,
1302
- ** telemetry_kwargs ,
1303
- )
1304
-
1305
- except Exception as e :
1306
1285
if data_science_work_request ._error_message :
1307
1286
error_str = ""
1308
1287
for error in data_science_work_request ._error_message :
1309
1288
error_str = error_str + " " + error .message
1310
1289
1311
- status = ""
1312
- predict_logs = deployment .tail_logs ("predict" )
1313
- access_logs = deployment .tail_logs ("access" )
1314
- if access_logs and len (access_logs ) > 0 :
1315
- print (access_logs )
1316
- status = access_logs [0 ]["message" ]
1317
-
1318
- if predict_logs and len (predict_logs ) > 0 :
1319
- print ("predict_logs ############################" )
1320
- print (predict_logs )
1321
- status += predict_logs [0 ]["message" ]
1322
- status = re .sub (r"[^a-zA-Z0-9]" , "" , status )
1323
- error_str = re .sub (r"[^a-zA-Z0-9]" , "" , error_str )
1290
+ error_str = re .sub (r"[^a-zA-Z0-9]" , " " , error_str )
1324
1291
telemetry_kwargs = {
1325
1292
"ocid" : ocid ,
1326
1293
"model_name" : model_name ,
1327
1294
"status" : error_str + " " + status ,
1328
1295
}
1329
- print (telemetry_kwargs )
1330
- print ("############################" )
1331
1296
1332
1297
self .telemetry .record_event (
1333
1298
category = f"aqua/{ model_type } /deployment/status" ,
1334
1299
action = "FAILED" ,
1335
- detail = error_str ,
1336
1300
** telemetry_kwargs ,
1337
1301
)
1338
1302
else :
1339
- print (str (e ))
1340
- status = str (e )
1341
- predict_logs = deployment .tail_logs ("predict" )
1342
- access_logs = deployment .tail_logs ("access" )
1343
- if access_logs and len (access_logs ) > 0 :
1344
- print ("access log list ############################" )
1345
- print (access_logs )
1346
- status = access_logs [0 ]["message" ]
1347
-
1348
- if predict_logs and len (predict_logs ) > 0 :
1349
- print ("predict_logs ############################" )
1350
- print (predict_logs )
1351
- status += predict_logs [0 ]["message" ]
1352
-
1353
- status = re .sub (r"[^a-zA-Z0-9]" , "" , status )
1354
- error_str = re .sub (r"[^a-zA-Z0-9]" , "" , error_str )
1355
-
1303
+ status = + " " + str (e )
1356
1304
telemetry_kwargs = {
1357
1305
"ocid" : ocid ,
1358
1306
"model_name" : model_name ,
1359
- "status" : error_str + " " + status ,
1307
+ "status" : status ,
1360
1308
}
1361
- print (telemetry_kwargs )
1362
- print ("############################" )
1363
1309
1364
1310
self .telemetry .record_event (
1365
1311
category = f"aqua/{ model_type } /deployment/status" ,
1366
1312
action = "FAILED" ,
1367
- # detail=error_str,
1368
1313
** telemetry_kwargs ,
1369
1314
)
1370
1315
0 commit comments