diff --git a/sdk/ml/azure-ai-ml/CHANGELOG.md b/sdk/ml/azure-ai-ml/CHANGELOG.md index f8107b2bbb28..469dd1d4e147 100644 --- a/sdk/ml/azure-ai-ml/CHANGELOG.md +++ b/sdk/ml/azure-ai-ml/CHANGELOG.md @@ -6,6 +6,7 @@ - Added Spark runtime 3.5 support for model monitoring serverless Spark compute while retaining runtime 3.4 support. ### Bugs Fixed +- Fixed directory uploads not propagating errors when progress reporting is disabled. - Fixed artifact cache path validation, wildcard version handling across supported Python versions, and concurrent downloads for component `additional_includes`. - Fixed artifact cache reads failing on transient Windows checksum-sharing errors during initial validation. - Improved the missing Azure CLI error reported when initializing the artifact cache. diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_asset_utils.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_asset_utils.py index 56595ba30eda..82e7d30d8801 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_asset_utils.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_utils/_asset_utils.py @@ -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( diff --git a/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_asset_utils.py b/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_asset_utils.py index 1146aa49cea9..091977752a7c 100644 --- a/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_asset_utils.py +++ b/sdk/ml/azure-ai-ml/tests/internal_utils/unittests/test_asset_utils.py @@ -5,6 +5,7 @@ import tempfile from pathlib import Path from typing import Callable, List, Tuple +from unittest.mock import patch import pytest @@ -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 @@ -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: