28
28
from ads .aqua .constants import *
29
29
from ads .aqua .data import AquaResourceIdentifier
30
30
from ads .common .auth import default_signer
31
+ from ads .common .decorator import threaded
31
32
from ads .common .extended_enum import ExtendedEnumMeta
32
33
from ads .common .object_storage_details import ObjectStorageDetails
33
34
from ads .common .oci_resource import SEARCH_TYPE , OCIResource
34
- from ads .common .utils import get_console_link , upload_to_os , copy_file
35
+ from ads .common .utils import copy_file , get_console_link , upload_to_os
35
36
from ads .config import AQUA_SERVICE_MODELS_BUCKET , CONDA_BUCKET_NS , TENANCY_OCID
36
37
from ads .model import DataScienceModel , ModelVersionSet
37
38
@@ -195,6 +196,7 @@ def read_file(file_path: str, **kwargs) -> str:
195
196
return UNKNOWN
196
197
197
198
199
+ @threaded (timeout = 5 )
198
200
def load_config (file_path : str , config_file_name : str , ** kwargs ) -> dict :
199
201
artifact_path = f"{ file_path .rstrip ('/' )} /{ config_file_name } "
200
202
if artifact_path .startswith ("oci://" ):
@@ -540,8 +542,10 @@ def get_container_image(
540
542
541
543
542
544
def fetch_service_compartment () -> Union [str , None ]:
543
- """Loads the compartment mapping json from service bucket. This json file has a service-model-compartment key which
544
- contains a dictionary of namespaces and the compartment OCID of the service models in that namespace.
545
+ """
546
+ Loads the compartment mapping json from service bucket.
547
+ This json file has a service-model-compartment key which contains a dictionary of namespaces
548
+ and the compartment OCID of the service models in that namespace.
545
549
"""
546
550
config_file_name = (
547
551
f"oci://{ AQUA_SERVICE_MODELS_BUCKET } @{ CONDA_BUCKET_NS } /service_models/config"
@@ -554,8 +558,8 @@ def fetch_service_compartment() -> Union[str, None]:
554
558
)
555
559
except Exception as e :
556
560
logger .debug (
557
- f"Config file { config_file_name } /{ CONTAINER_INDEX } to fetch service compartment OCID could not be found. "
558
- f"\n { str (e )} ."
561
+ f"Config file { config_file_name } /{ CONTAINER_INDEX } to fetch service compartment OCID "
562
+ f"could not be found. \n { str (e )} ."
559
563
)
560
564
return
561
565
compartment_mapping = config .get (COMPARTMENT_MAPPING_KEY )
0 commit comments