Skip to content

Commit 666dc51

Browse files
authored
Merge branch 'main' into docs/AQUA_API_Setup
2 parents 565eecf + 1932376 commit 666dc51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2830
-694
lines changed

THIRD_PARTY_LICENSES.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ fsspec
9696
* Source code: https://github.com/intake/filesystem_spec
9797
* Project home: https://github.com/intake/filesystem_spec
9898

99+
httpx
100+
* Copyright (c) 2021 ProjectDiscovery, Inc.
101+
* License: MIT License
102+
* Source code: https://github.com/projectdiscovery/httpx
103+
* Project home: https://github.com/projectdiscovery/httpx
104+
99105
geopandas
100106
* Copyright (c) 2013-2016, GeoPandas developers
101107
* License: BSD 3-Clause "New" or "Revised" License
@@ -391,6 +397,12 @@ tabulate
391397
* Source code: https://github.com/astanin/python-tabulate
392398
* Project home: https://github.com/astanin/python-tabulate
393399

400+
tenacity
401+
* No listed copyright holder
402+
* License: Apache-2.0 license
403+
* Source code: https://github.com/jd/tenacity
404+
* Project home: https://github.com/jd/tenacity
405+
394406
tensorflow
395407
* Copyright (c) 2023 Google, Inc.
396408
* License: Apache-2.0 license

ads/aqua/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import os
77
from logging import getLogger
88

9-
from ads import set_auth
9+
from ads import logger, set_auth
10+
from ads.aqua.client.client import AsyncClient, Client
1011
from ads.aqua.common.utils import fetch_service_compartment
1112
from ads.config import OCI_RESOURCE_PRINCIPAL_VERSION
1213

ads/aqua/app.py

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
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
66
import os
7+
import traceback
78
from dataclasses import fields
89
from typing import Dict, Union
910

@@ -23,7 +24,7 @@
2324
from ads.aqua.constants import UNKNOWN
2425
from ads.common import oci_client as oc
2526
from ads.common.auth import default_signer
26-
from ads.common.utils import extract_region
27+
from ads.common.utils import extract_region, is_path_exists
2728
from ads.config import (
2829
AQUA_TELEMETRY_BUCKET,
2930
AQUA_TELEMETRY_BUCKET_NS,
@@ -296,33 +297,46 @@ def get_config(self, model_id: str, config_file_name: str) -> Dict:
296297
raise AquaRuntimeError(f"Target model {oci_model.id} is not Aqua model.")
297298

298299
config = {}
299-
artifact_path = get_artifact_path(oci_model.custom_metadata_list)
300+
# if the current model has a service model tag, then
301+
if Tags.AQUA_SERVICE_MODEL_TAG in oci_model.freeform_tags:
302+
base_model_ocid = oci_model.freeform_tags[Tags.AQUA_SERVICE_MODEL_TAG]
303+
logger.info(
304+
f"Base model found for the model: {oci_model.id}. "
305+
f"Loading {config_file_name} for base model {base_model_ocid}."
306+
)
307+
base_model = self.ds_client.get_model(base_model_ocid).data
308+
artifact_path = get_artifact_path(base_model.custom_metadata_list)
309+
else:
310+
logger.info(f"Loading {config_file_name} for model {oci_model.id}...")
311+
artifact_path = get_artifact_path(oci_model.custom_metadata_list)
312+
300313
if not artifact_path:
301-
logger.error(
314+
logger.debug(
302315
f"Failed to get artifact path from custom metadata for the model: {model_id}"
303316
)
304317
return config
305318

306-
try:
307-
config_path = f"{os.path.dirname(artifact_path)}/config/"
308-
config = load_config(
309-
config_path,
310-
config_file_name=config_file_name,
311-
)
312-
except Exception:
313-
# todo: temp fix for issue related to config load for byom models, update logic to choose the right path
319+
config_path = f"{os.path.dirname(artifact_path)}/config/"
320+
if not is_path_exists(config_path):
321+
config_path = f"{artifact_path.rstrip('/')}/config/"
322+
323+
config_file_path = f"{config_path}{config_file_name}"
324+
if is_path_exists(config_file_path):
314325
try:
315-
config_path = f"{artifact_path.rstrip('/')}/config/"
316326
config = load_config(
317327
config_path,
318328
config_file_name=config_file_name,
319329
)
320330
except Exception:
321-
pass
331+
logger.debug(
332+
f"Error loading the {config_file_name} at path {config_path}.\n"
333+
f"{traceback.format_exc()}"
334+
)
322335

323336
if not config:
324-
logger.error(
325-
f"{config_file_name} is not available for the model: {model_id}. Check if the custom metadata has the artifact path set."
337+
logger.debug(
338+
f"{config_file_name} is not available for the model: {model_id}. "
339+
f"Check if the custom metadata has the artifact path set."
326340
)
327341
return config
328342

ads/aqua/client/__init__.py

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

0 commit comments

Comments
 (0)