Skip to content

Commit 782e0b6

Browse files
committed
init code for fix
1 parent a40168f commit 782e0b6

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

ads/model/runtime/utils.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,15 @@
55
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66

77
import json
8+
import logging
89
import os
9-
from functools import lru_cache
1010
from typing import Dict, Tuple
11-
import logging
1211

1312
import fsspec
14-
import requests
1513
import yaml
1614
from cerberus import DocumentError, Validator
1715

1816
from ads.common.object_storage_details import ObjectStorageDetails
19-
from ads.common.utils import PAR_LINK
2017

2118
MODEL_PROVENANCE_SCHEMA_PATH = os.path.join(
2219
os.path.dirname(os.path.abspath(__file__)),
@@ -127,8 +124,8 @@ def _get_index_json_through_bucket(
127124
service_packs = json.loads(f.read())
128125
service_pack_list = service_packs.get(SERVICE_PACKS)
129126
except Exception as e:
130-
logging.warn(e)
131-
logging.warn(
127+
logging.warning(e)
128+
logging.warning(
132129
"Failed to retrieve the full conda pack path from slug. Pass conda pack path 'oci://<bucketname>@<namespace>/<path_to_conda>' instead of slug."
133130
)
134131
return service_pack_list
@@ -160,21 +157,15 @@ def get_service_packs(
160157
service_pack_path_mapping = {}
161158
service_pack_slug_mapping = {}
162159
try:
163-
response = requests.request("GET", PAR_LINK)
164-
165-
# if there is internet
166-
if response.ok:
167-
service_pack_list = response.json().get(SERVICE_PACKS)
168-
# response not good.
169-
else:
170-
service_pack_list = _get_index_json_through_bucket(
171-
namespace=namespace, bucketname=bucketname, auth=auth
172-
)
173-
except Exception as e:
174-
# not internet
160+
logging.info("Obtaining service packs through bucket.")
175161
service_pack_list = _get_index_json_through_bucket(
176162
namespace=namespace, bucketname=bucketname, auth=auth
177163
)
164+
except Exception as e:
165+
# not internet
166+
logging.warning(e)
167+
logging.warning("Failed to obtain service packs through bucket. Please ensure internet connection.")
168+
178169

179170
for service_pack in service_pack_list:
180171
# Here we need to replace the namespace and bucketname

0 commit comments

Comments
 (0)