Skip to content

Commit 693084d

Browse files
authored
Pdhote/fix model download (Azure#38977)
* fix resolving path_prefix from asset url * add unit test * add info changelog * path prefix from asset-url
1 parent 8bff427 commit 693084d

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

sdk/ml/azure-ai-ml/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
### Bugs Fixed
77
- Fixed disableLocalAuthentication handling while creating amlCompute
8+
- Fixed model download issue
89

910
## 1.23.0 (2024-12-05)
1011

sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_storage_utils.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,7 @@ def get_ds_name_and_path_prefix(asset_uri: str, registry_name: Optional[str] = N
191191
if registry_name:
192192
try:
193193
split_paths = re.findall(STORAGE_URI_REGEX, asset_uri)
194-
if split_paths[0][3] == "":
195-
path_prefix = split_paths[0][2]
196-
else:
197-
path_prefix = split_paths[0][3]
194+
path_prefix = split_paths[0][-1]
198195
except Exception as e:
199196
msg = "Registry asset URI could not be parsed."
200197
raise MlException(message=msg, no_personal_data_message=msg) from e

sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_storage_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def test_storage_uri_to_prefix(
101101
reg_uri_1 = "https://ccccccccddddd345.blob.core.windows.net/demoregist-16d33653-20bf-549b-a3c1-17d975359581/ExperimentRun/dcid.5823bbb4-bb28-497c-b9f2-1ff3a0778b10/model"
102102
reg_uri_2 = "https://ccccccccccc1978ccc.blob.core.windows.net/demoregist-b46fb119-d3f8-5994-a971-a9c730227846/LocalUpload/0c225a0230907e61c00ea33eac35a54d/model.pkl"
103103
reg_uri_3 = "https://ccccccccddr546ddd.blob.core.windows.net/some-reg-9717e928-33c2-50c2-90f5-f410b12b8727/sklearn_regression_model.pkl"
104+
reg_uri_4 = "https://ccccccccddr546ddd.blob.core.windows.net/some-reg-c42e6002-ea61-510a-9414-bc4504b74f9f"
104105
workspace_uri_1 = "azureml://subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/000000000000000/workspaces/some_test_3/datastores/workspaceblobstore/paths/LocalUpload/26960525964086056a7301dd061fb9be/lightgbm_mlflow_model"
105106

106107
assert get_ds_name_and_path_prefix(reg_uri_1, "registry_name") == (
@@ -112,6 +113,7 @@ def test_storage_uri_to_prefix(
112113
"LocalUpload/0c225a0230907e61c00ea33eac35a54d/model.pkl",
113114
)
114115
assert get_ds_name_and_path_prefix(reg_uri_3, "registry_name") == (None, "sklearn_regression_model.pkl")
116+
assert get_ds_name_and_path_prefix(reg_uri_4, "registry_name") == (None, "")
115117
assert get_ds_name_and_path_prefix(workspace_uri_1) == (
116118
"workspaceblobstore",
117119
"LocalUpload/26960525964086056a7301dd061fb9be/lightgbm_mlflow_model",

0 commit comments

Comments
 (0)