@@ -833,13 +833,13 @@ def get(self, eval_id) -> AquaEvaluationDetail:
833
833
logger .info (f"Fetching evaluation: { eval_id } details ..." )
834
834
835
835
resource = utils .query_resource (eval_id )
836
- model_provenance = self .ds_client .get_model_provenance (eval_id ).data
837
-
838
836
if not resource :
839
837
raise AquaRuntimeError (
840
838
f"Failed to retrieve evalution { eval_id } ."
841
839
"Please check if the OCID is correct."
842
840
)
841
+ model_provenance = self .ds_client .get_model_provenance (eval_id ).data
842
+
843
843
jobrun_id = model_provenance .training_id
844
844
job_run_details = self ._fetch_jobrun (
845
845
resource , use_rqs = False , jobrun_id = jobrun_id
@@ -1038,14 +1038,14 @@ def get_status(self, eval_id: str) -> dict:
1038
1038
"""
1039
1039
eval = utils .query_resource (eval_id )
1040
1040
1041
- # TODO: add job_run_id as input param to skip the query below
1042
- model_provenance = self .ds_client .get_model_provenance (eval_id ).data
1043
-
1044
1041
if not eval :
1045
1042
raise AquaRuntimeError (
1046
1043
f"Failed to retrieve evalution { eval_id } ."
1047
1044
"Please check if the OCID is correct."
1048
1045
)
1046
+
1047
+ model_provenance = self .ds_client .get_model_provenance (eval_id ).data
1048
+
1049
1049
jobrun_id = model_provenance .training_id
1050
1050
job_run_details = self ._fetch_jobrun (eval , use_rqs = False , jobrun_id = jobrun_id )
1051
1051
@@ -1295,7 +1295,10 @@ def cancel(self, eval_id) -> dict:
1295
1295
raise AquaRuntimeError (
1296
1296
f"Failed to get evaluation details for model { eval_id } "
1297
1297
)
1298
- job_run_id = model .provenance_metadata .training_id
1298
+
1299
+ job_run_id = (
1300
+ model .provenance_metadata .training_id if model .provenance_metadata else None
1301
+ )
1299
1302
if not job_run_id :
1300
1303
raise AquaMissingKeyError (
1301
1304
"Model provenance is missing job run training_id key"
@@ -1358,7 +1361,7 @@ def delete(self, eval_id):
1358
1361
job_id = model .custom_metadata_list .get (
1359
1362
EvaluationCustomMetadata .EVALUATION_JOB_ID .value
1360
1363
).value
1361
- except ValueError :
1364
+ except Exception :
1362
1365
raise AquaMissingKeyError (
1363
1366
f"Custom metadata is missing { EvaluationCustomMetadata .EVALUATION_JOB_ID .value } key"
1364
1367
)
@@ -1390,7 +1393,7 @@ def _delete_job_and_model(job, model):
1390
1393
)
1391
1394
1392
1395
def load_evaluation_config (self , eval_id ):
1393
- # TODO
1396
+ """Loads evaluation config."""
1394
1397
return {
1395
1398
"model_params" : {
1396
1399
"max_tokens" : 500 ,
@@ -1568,20 +1571,6 @@ def _build_resource_identifier(
1568
1571
)
1569
1572
return AquaResourceIdentifier ()
1570
1573
1571
- def _get_jobrun (
1572
- self , model : oci .resource_search .models .ResourceSummary , mapping : dict = {}
1573
- ) -> Union [
1574
- oci .resource_search .models .ResourceSummary , oci .data_science .models .JobRun
1575
- ]:
1576
- jobrun_id = self ._get_attribute_from_model_metadata (
1577
- model , EvaluationCustomMetadata .EVALUATION_JOB_RUN_ID .value
1578
- )
1579
- job_run = mapping .get (jobrun_id )
1580
-
1581
- if not job_run :
1582
- job_run = self ._fetch_jobrun (model , use_rqs = True , jobrun_id = jobrun_id )
1583
- return job_run
1584
-
1585
1574
def _fetch_jobrun (
1586
1575
self ,
1587
1576
resource : oci .resource_search .models .ResourceSummary ,
@@ -1758,7 +1747,7 @@ def _extract_job_lifecycle_details(self, lifecycle_details: str) -> str:
1758
1747
Examples
1759
1748
--------
1760
1749
>>> _extract_job_lifecycle_details("Job run artifact execution failed with exit code 16")
1761
- 'The evaluation configuration is invalid due to content validation errors .'
1750
+ 'Validation errors in the evaluation config. Exit code: 16 .'
1762
1751
1763
1752
>>> _extract_job_lifecycle_details("Job completed successfully.")
1764
1753
'Job completed successfully.'
0 commit comments