Skip to content

Commit

Permalink
Download azure blob (#2051)
Browse files Browse the repository at this point in the history
* azure blob model source changes

* Update downloader.py

updated the changes

* Update downloader.py

updated changes

* Update downloader.py

updated the changes

* Update downloader.py

done the changes

* Updated version of components

---------

Co-authored-by: vikasagrawal-ms <[email protected]>
  • Loading branch information
MallikharjunaThota123 and vikasagrawal-ms authored Jan 2, 2024
1 parent b84b6af commit 477a92e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json

name: download_model
version: 0.0.17
version: 0.0.18
type: command

is_deterministic: True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type: pipeline
name: import_model
display_name: Import model
description: Import a model into a workspace or a registry
version: 0.0.20
version: 0.0.21

# Pipeline inputs
inputs:
Expand Down Expand Up @@ -210,7 +210,7 @@ jobs:
type: uri_file

download_model:
component: azureml:download_model:0.0.17
component: azureml:download_model:0.0.18
compute: ${{parent.inputs.compute}}
resources:
instance_type: '${{parent.inputs.instance_type}}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,14 @@ def __init__(self, model_uri: str, download_dir: Path):
@log_execution_time
def _download(self):
try:
download_cmd = f"azcopy cp --recursive=true '{self._model_uri}' {self._download_dir}"
download_cmd = f"azcopy cp --recursive=true '{self._model_uri}/*' {self._download_dir}"
# TODO: Handle error case correctly, since azcopy exits with 0 exit code, even in case of error.
# https://github.com/Azure/azureml-assets/issues/283
exit_code, stdout = run_command(download_cmd)
if exit_code != 0:
raise AzureMLException._with_error(
AzureMLError.create(BlobStorageDownloadError, uri=self._model_uri, error=stdout)
)

return {
"download_time_utc": get_system_time_utc(),
"size": round_size(get_file_or_folder_size(self._download_dir)),
Expand Down

0 comments on commit 477a92e

Please sign in to comment.