Skip to content

Commit 8f21350

Browse files
authored
Merge branch 'main' into feature/odsc-65115
2 parents 9b457c7 + b970eb5 commit 8f21350

File tree

14 files changed

+319
-139
lines changed

14 files changed

+319
-139
lines changed

ads/aqua/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
# Copyright (c) 2024 Oracle and/or its affiliates.
2+
# Copyright (c) 2024, 2025 Oracle and/or its affiliates.
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
44

55
import json
@@ -298,7 +298,7 @@ def get_config(self, model_id: str, config_file_name: str) -> Dict:
298298
config = {}
299299
artifact_path = get_artifact_path(oci_model.custom_metadata_list)
300300
if not artifact_path:
301-
logger.error(
301+
logger.debug(
302302
f"Failed to get artifact path from custom metadata for the model: {model_id}"
303303
)
304304
return config

ads/aqua/evaluation/evaluation.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
# Copyright (c) 2024 Oracle and/or its affiliates.
2+
# Copyright (c) 2024, 2025 Oracle and/or its affiliates.
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
44
import base64
55
import json
@@ -199,11 +199,11 @@ def create(
199199
eval_inference_configuration = (
200200
container.spec.evaluation_configuration
201201
)
202-
except Exception:
202+
except Exception as ex:
203203
logger.debug(
204204
f"Could not load inference config details for the evaluation source id: "
205205
f"{create_aqua_evaluation_details.evaluation_source_id}. Please check if the container"
206-
f" runtime has the correct SMC image information."
206+
f" runtime has the correct SMC image information.\nError: {str(ex)}"
207207
)
208208
elif (
209209
DataScienceResource.MODEL
@@ -289,7 +289,7 @@ def create(
289289
f"Invalid experiment name. Please provide an experiment with `{Tags.AQUA_EVALUATION}` in tags."
290290
)
291291
except Exception:
292-
logger.debug(
292+
logger.info(
293293
f"Model version set {experiment_model_version_set_name} doesn't exist. "
294294
"Creating new model version set."
295295
)
@@ -711,21 +711,27 @@ def get(self, eval_id) -> AquaEvaluationDetail:
711711
try:
712712
log = utils.query_resource(log_id, return_all=False)
713713
log_name = log.display_name if log else ""
714-
except Exception:
714+
except Exception as ex:
715+
logger.debug(f"Failed to get associated log name. Error: {ex}")
715716
pass
716717

717718
if loggroup_id:
718719
try:
719720
loggroup = utils.query_resource(loggroup_id, return_all=False)
720721
loggroup_name = loggroup.display_name if loggroup else ""
721-
except Exception:
722+
except Exception as ex:
723+
logger.debug(f"Failed to get associated loggroup name. Error: {ex}")
722724
pass
723725

724726
try:
725727
introspection = json.loads(
726728
self._get_attribute_from_model_metadata(resource, "ArtifactTestResults")
727729
)
728-
except Exception:
730+
except Exception as ex:
731+
logger.debug(
732+
f"There was an issue loading the model attribute as json object for evaluation {eval_id}. "
733+
f"Setting introspection to empty.\n Error:{ex}"
734+
)
729735
introspection = {}
730736

731737
summary = AquaEvaluationDetail(
@@ -878,13 +884,13 @@ def get_status(self, eval_id: str) -> dict:
878884
try:
879885
log_id = job_run_details.log_details.log_id
880886
except Exception as e:
881-
logger.debug(f"Failed to get associated log. {str(e)}")
887+
logger.debug(f"Failed to get associated log.\nError: {str(e)}")
882888
log_id = ""
883889

884890
try:
885891
loggroup_id = job_run_details.log_details.log_group_id
886892
except Exception as e:
887-
logger.debug(f"Failed to get associated log. {str(e)}")
893+
logger.debug(f"Failed to get associated log.\nError: {str(e)}")
888894
loggroup_id = ""
889895

890896
loggroup_url = get_log_links(region=self.region, log_group_id=loggroup_id)
@@ -958,7 +964,7 @@ def load_metrics(self, eval_id: str) -> AquaEvalMetrics:
958964
)
959965
except Exception as e:
960966
logger.debug(
961-
"Failed to load `report.json` from evaluation artifact" f"{str(e)}"
967+
f"Failed to load `report.json` from evaluation artifact.\nError: {str(e)}"
962968
)
963969
json_report = {}
964970

@@ -1047,6 +1053,7 @@ def download_report(self, eval_id) -> AquaEvalReport:
10471053
return report
10481054

10491055
with tempfile.TemporaryDirectory() as temp_dir:
1056+
logger.info(f"Downloading evaluation artifact for {eval_id}.")
10501057
DataScienceModel.from_id(eval_id).download_artifact(
10511058
temp_dir,
10521059
auth=self._auth,
@@ -1200,6 +1207,7 @@ def _delete_job_and_model(job, model):
12001207
def load_evaluation_config(self, container: Optional[str] = None) -> Dict:
12011208
"""Loads evaluation config."""
12021209

1210+
logger.info("Loading evaluation container config.")
12031211
# retrieve the evaluation config by container family name
12041212
evaluation_config = get_evaluation_service_config(container)
12051213

@@ -1279,9 +1287,9 @@ def _get_source(
12791287
raise AquaRuntimeError(
12801288
f"Not supported source type: {resource_type}"
12811289
)
1282-
except Exception:
1290+
except Exception as ex:
12831291
logger.debug(
1284-
f"Failed to retrieve source information for evaluation {evaluation.identifier}."
1292+
f"Failed to retrieve source information for evaluation {evaluation.identifier}.\nError: {str(ex)}"
12851293
)
12861294
source_name = ""
12871295

ads/aqua/extension/aqua_ws_msg_handler.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*--
32

4-
# Copyright (c) 2024 Oracle and/or its affiliates.
3+
# Copyright (c) 2024, 2025 Oracle and/or its affiliates.
54
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
65

76
import traceback
7+
import uuid
88
from abc import abstractmethod
99
from http.client import responses
1010
from typing import List
@@ -34,7 +34,7 @@ def __init__(self, message: str):
3434
self.telemetry = TelemetryClient(
3535
bucket=AQUA_TELEMETRY_BUCKET, namespace=AQUA_TELEMETRY_BUCKET_NS
3636
)
37-
except:
37+
except Exception:
3838
pass
3939

4040
@staticmethod
@@ -66,24 +66,31 @@ def write_error(self, status_code, **kwargs):
6666
"message": message,
6767
"service_payload": service_payload,
6868
"reason": reason,
69+
"request_id": str(uuid.uuid4()),
6970
}
7071
exc_info = kwargs.get("exc_info")
7172
if exc_info:
72-
logger.error("".join(traceback.format_exception(*exc_info)))
73+
logger.error(
74+
f"Error Request ID: {reply['request_id']}\n"
75+
f"Error: {''.join(traceback.format_exception(*exc_info))}"
76+
)
7377
e = exc_info[1]
7478
if isinstance(e, HTTPError):
7579
reply["message"] = e.log_message or message
7680
reply["reason"] = e.reason
77-
else:
78-
logger.warning(reply["message"])
81+
82+
logger.error(
83+
f"Error Request ID: {reply['request_id']}\n"
84+
f"Error: {reply['message']} {reply['reason']}"
85+
)
7986
# telemetry may not be present if there is an error while initializing
8087
if hasattr(self, "telemetry"):
8188
aqua_api_details = kwargs.get("aqua_api_details", {})
8289
self.telemetry.record_event_async(
8390
category="aqua/error",
8491
action=str(status_code),
8592
value=reason,
86-
**aqua_api_details
93+
**aqua_api_details,
8794
)
8895
response = AquaWsError(
8996
status=status_code,

ads/aqua/extension/base_handler.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
3-
# Copyright (c) 2024 Oracle and/or its affiliates.
2+
# Copyright (c) 2024, 2025 Oracle and/or its affiliates.
43
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
54

65

@@ -35,7 +34,7 @@ def __init__(
3534
self.telemetry = TelemetryClient(
3635
bucket=AQUA_TELEMETRY_BUCKET, namespace=AQUA_TELEMETRY_BUCKET_NS
3736
)
38-
except:
37+
except Exception:
3938
pass
4039

4140
@staticmethod
@@ -82,19 +81,23 @@ def write_error(self, status_code, **kwargs):
8281
"message": message,
8382
"service_payload": service_payload,
8483
"reason": reason,
84+
"request_id": str(uuid.uuid4()),
8585
}
8686
exc_info = kwargs.get("exc_info")
8787
if exc_info:
88-
logger.error("".join(traceback.format_exception(*exc_info)))
88+
logger.error(
89+
f"Error Request ID: {reply['request_id']}\n"
90+
f"Error: {''.join(traceback.format_exception(*exc_info))}"
91+
)
8992
e = exc_info[1]
9093
if isinstance(e, HTTPError):
9194
reply["message"] = e.log_message or message
9295
reply["reason"] = e.reason if e.reason else reply["reason"]
93-
reply["request_id"] = str(uuid.uuid4())
94-
else:
95-
reply["request_id"] = str(uuid.uuid4())
9696

97-
logger.warning(reply["message"])
97+
logger.error(
98+
f"Error Request ID: {reply['request_id']}\n"
99+
f"Error: {reply['message']} {reply['reason']}"
100+
)
98101

99102
# telemetry may not be present if there is an error while initializing
100103
if hasattr(self, "telemetry"):
@@ -103,7 +106,7 @@ def write_error(self, status_code, **kwargs):
103106
category="aqua/error",
104107
action=str(status_code),
105108
value=reason,
106-
**aqua_api_details
109+
**aqua_api_details,
107110
)
108111

109112
self.finish(json.dumps(reply))

ads/aqua/extension/model_handler.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ def post(self, *args, **kwargs): # noqa: ARG002
140140
ignore_patterns = input_data.get("ignore_patterns")
141141
freeform_tags = input_data.get("freeform_tags")
142142
defined_tags = input_data.get("defined_tags")
143+
ignore_model_artifact_check = (
144+
str(input_data.get("ignore_model_artifact_check", "false")).lower()
145+
== "true"
146+
)
143147

144148
return self.finish(
145149
AquaModelApp().register(
@@ -158,6 +162,7 @@ def post(self, *args, **kwargs): # noqa: ARG002
158162
ignore_patterns=ignore_patterns,
159163
freeform_tags=freeform_tags,
160164
defined_tags=defined_tags,
165+
ignore_model_artifact_check=ignore_model_artifact_check,
161166
)
162167
)
163168

ads/aqua/finetuning/finetuning.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,19 @@ def create(
382382
defined_tags=model_defined_tags,
383383
),
384384
)
385+
logger.debug(
386+
f"Successfully updated model custom metadata list and freeform tags for the model {ft_model.id}."
387+
)
385388

386389
self.update_model_provenance(
387390
model_id=ft_model.id,
388391
update_model_provenance_details=UpdateModelProvenanceDetails(
389392
training_id=ft_job_run.id
390393
),
391394
)
395+
logger.debug(
396+
f"Successfully updated model provenance for the model {ft_model.id}."
397+
)
392398

393399
# tracks the shape and replica used for fine-tuning the service models
394400
telemetry_kwargs = (
@@ -564,7 +570,7 @@ def get_finetuning_config(self, model_id: str) -> Dict:
564570
config = self.get_config(model_id, AQUA_MODEL_FINETUNING_CONFIG)
565571
if not config:
566572
logger.debug(
567-
f"Fine-tuning config for custom model: {model_id} is not available."
573+
f"Fine-tuning config for custom model: {model_id} is not available. Use defaults."
568574
)
569575
return config
570576

ads/aqua/model/entities.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ class ImportModelDetails(CLIBuilderMixin):
294294
ignore_patterns: Optional[List[str]] = None
295295
freeform_tags: Optional[dict] = None
296296
defined_tags: Optional[dict] = None
297+
ignore_model_artifact_check: Optional[bool] = None
297298

298299
def __post_init__(self):
299300
self._command = "model register"

0 commit comments

Comments
 (0)