Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions scripts/azureml-assets/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## 1.17.0 (Unreleased)
### 🚀 New Features

## 1.16.82 (2025-05-22)
### 🚀 New Features
- [#4206](https://github.com/Azure/azureml-assets/pull/4206) Print azcopy log if output_level==default

## 1.16.81 (2025-05-15)
### 🚀 New Features
- [#4184](https://github.com/Azure/azureml-assets/pull/4184) Generate SAS token instead of checking container access
Expand Down
23 changes: 19 additions & 4 deletions scripts/azureml-assets/azureml/assets/model/download_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def _onerror(func, path, exc_info):
raise


def run_cmd(cmd, cwd: Path = None) -> int:
def run_cmd(cmd, cwd: Path | None = None, env: dict | None = None) -> int:
"""Run the command and returns the result."""
logger.print(cmd)
result = subprocess.run(
Expand All @@ -104,6 +104,7 @@ def run_cmd(cmd, cwd: Path = None) -> int:
stderr=subprocess.STDOUT,
encoding=sys.stdout.encoding,
errors="ignore",
env=env,
)
if result.returncode != 0:
logger.log_error(f"Failed with error {result.stdout}")
Expand Down Expand Up @@ -173,9 +174,23 @@ def run_azcopy(src_uri: str, dstn_uri: str, include_paths: List[str] = None, exc
if not overwrite:
download_cmd.append("--overwrite=false")

result = run_cmd(download_cmd)
logger.print(f"azcopy result: {result}")
return result
# Create a tempdir and set AZCOPY_LOG_LOCATION in env
with tempfile.TemporaryDirectory() as temp_log_dir:
env = os.environ.copy()
env["AZCOPY_LOG_LOCATION"] = temp_log_dir
result = run_cmd(download_cmd, env=env)
logger.print(f"azcopy result: {result}")

if output_level == "default":
# list all files in the temp log dir
for root, _, files in os.walk(temp_log_dir):
for file in files:
file_path = os.path.join(root, file)
logger.print(f"azcopy log file: {file_path}")
with open(file_path, "r") as f:
logger.print(f.read())

return result


def copy_azure_artifacts(src_uri: str, dstn_uri: str, copy_updater: CopyUpdater = None,
Expand Down
2 changes: 1 addition & 1 deletion scripts/azureml-assets/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="azureml-assets",
version="1.16.81",
version="1.16.82",
description="Utilities for publishing assets to Azure Machine Learning system registries.",
author="Microsoft Corp",
packages=find_packages(),
Expand Down
Loading