Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_asset_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,9 @@ def upload_directory(
future.result() # access result to propagate any exceptions
file_path_name = futures_dict[future][0]
pbar.update(size_dict.get(file_path_name) or 0)
else:
for future in as_completed(futures_dict):
future.result()


@retry(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import tempfile
from pathlib import Path
from typing import Callable, List, Tuple
from unittest.mock import patch

import pytest

Expand All @@ -19,6 +20,7 @@
get_ignore_file,
get_object_hash,
get_upload_files_from_folder,
upload_directory,
)
from azure.ai.ml._utils.utils import convert_windows_path_to_unix
from azure.ai.ml.constants._common import AutoDeleteCondition
Expand Down Expand Up @@ -174,6 +176,19 @@ def basic_file(cls) -> "SymbolLinkTestCase":
@pytest.mark.unittest
@pytest.mark.core_sdk_test
class TestAssetUtils:
def test_upload_directory_propagates_errors_without_progress(self, tmp_path: Path) -> None:
class BlobStorageClient:
def check_blob_exists(self):
pass

source = tmp_path / "source"
source.mkdir()
(source / "file.txt").write_text("content")

with patch("azure.ai.ml._utils._asset_utils.upload_file", side_effect=RuntimeError("upload failed")):
with pytest.raises(RuntimeError, match="upload failed"):
upload_directory(BlobStorageClient(), source, "destination", "Uploading", False, IgnoreFile(None))

def test_amlignore_precedence(
self, storage_test_directory: str, gitignore_file_directory: str, no_ignore_file_directory: str
) -> None:
Expand Down
Loading