Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest az cli fails to run download-batch command #21966

Closed
taoisu opened this issue Apr 6, 2022 · 16 comments · Fixed by #22072
Closed

Latest az cli fails to run download-batch command #21966

taoisu opened this issue Apr 6, 2022 · 16 comments · Fixed by #22072
Assignees
Labels
Auto-Assign Auto assign by bot customer-reported Issues that are reported by GitHub users external to the Azure organization. Storage az storage
Milestone

Comments

@taoisu
Copy link

taoisu commented Apr 6, 2022

%23%23%23 This is autogenerated. Please review and update as needed.

%23%23 Describe the bug

Command Name
az storage blob download-batch

Errors:

The command failed with an unexpected error. Here is the traceback:
'BlobServiceClient' object has no attribute 'exists'
Traceback (most recent call last):
  File "/opt/az/lib/python3.8/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 658, in execute
    raise ex
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 721, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 713, in _run_job
    return cmd_copy.exception_handler(ex)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/command_modules/storage/__init__.py", line 385, in new_handler
    first(ex)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/command_modules/storage/__init__.py", line 385, in new_handler
    first(ex)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/command_modules/storage/_exception_handler.py", line 17, in file_related_exception_handler
    raise ex
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 692, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/command_modules/storage/operations/blob.py", line 363, in storage_blob_download_batch
    source_blobs = collect_blobs(client, source_container_name, pattern)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/command_modules/storage/util.py", line 16, in collect_blobs
    return [name for (name, _) in collect_blob_objects(blob_service, container, pattern)]
  File "/opt/az/lib/python3.8/site-packages/azure/cli/command_modules/storage/util.py", line 16, in <listcomp>
    return [name for (name, _) in collect_blob_objects(blob_service, container, pattern)]
  File "/opt/az/lib/python3.8/site-packages/azure/cli/command_modules/storage/util.py", line 31, in collect_blob_objects
    if blob_service.exists(container, pattern):
AttributeError: 'BlobServiceClient' object has no attribute 'exists'

%23%23 To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az storage blob download-batch -d {} -s {} --auth-mode {} --account-name {} --subscription {} --pattern {}

%23%23 Expected Behavior

%23%23 Environment Summary

Linux-5.4.0-1063-azure-x86_64-with-glibc2.27, Ubuntu 18.04.6 LTS
Python 3.8.12
Installer: DEB

azure-cli 2.35.0

Extensions:
azure-cli-ml 1.37.0

Dependencies:
msal 1.17.0
azure-mgmt-resource 20.0.0

%23%23 Additional Context

@ghost ghost added customer-reported Issues that are reported by GitHub users external to the Azure organization. Storage az storage labels Apr 6, 2022
@ghost ghost added this to the Backlog milestone Apr 6, 2022
@ghost ghost assigned evelyn-ys Apr 6, 2022
@ghost ghost added Auto-Assign Auto assign by bot CXP Attention This issue is handled by CXP team. Machine Learning az ml Batch az batch labels Apr 6, 2022
@yonzhan
Copy link
Collaborator

yonzhan commented Apr 7, 2022

storage

@yonzhan yonzhan removed Batch az batch Machine Learning az ml CXP Attention This issue is handled by CXP team. labels Apr 7, 2022
@evelyn-ys
Copy link
Member

Can you share which pattern you are using?

@taoisu
Copy link
Author

taoisu commented Apr 7, 2022

Something as simple as "model.onnx".

It doesn't matter as far as I can tell, any pattern would fail. This just started to happen today, I was using azure cli in a docker image, I built the image yesterday it was working just fine, today I re-built the docker image the error started to show up.

@evelyn-ys
Copy link
Member

Actually --pattern only supports few cases. You can check the help message with CLI doc or az storage blob download-batch -h:

--pattern
The pattern used for globbing files or blobs in the source. The supported patterns are '*', '?', '[seq]', and '[!seq]'. For more information, please refer to https://docs.python.org/3.7/library/fnmatch.html.

@evelyn-ys
Copy link
Member

If you are giving a blob name as --pattern, I'll suggest you to use az storage blob download.
It used to work with previous CLI using az storage blob download-batch but we have an bug dealing with full blob name in latest CLI. This will be fixed in next release. But this usage is not documented in our help message or doc, so it's not recommended.

@taoisu
Copy link
Author

taoisu commented Apr 7, 2022

@evelyn-ys thanks for the investigation, but I'm afraid that is not the case for me. We've been using the same command for two years in one of our pipeline, and it was just broken today, so it is clear something is wrong in the az cli.

@taoisu
Copy link
Author

taoisu commented Apr 7, 2022

az storage blob download-batch -d {} -s jobs --auth-mode key --account-name {} --subscription {} --pattern output/invoice/20220402/layoutlm-TT_MH5MSL1024_Tier1_FT2/layoutlm@2022-04-02_22-37-11/model_artifacts/model.onnx

This is the full command we're using.

@taoisu
Copy link
Author

taoisu commented Apr 7, 2022

az storage blob download is not an option for us because we need --pattern specifically, one of the patterns is something like "*.bias"

@taoisu
Copy link
Author

taoisu commented Apr 7, 2022

I'm not sure if you just need to fix the latest CLI, because I've also tried installing previous versions (which works in the past), and I'm seeing the exactly the same issue.

@evelyn-ys
Copy link
Member

When installing previous versions, please make sure all the dependencies of latest version are uninstalled. I'm afraid there's some storage dependency left.

I'm not sure if you just need to fix the latest CLI, because I've also tried installing previous versions (which works in the past), and I'm seeing the exactly the same issue.

@evelyn-ys
Copy link
Member

az storage blob download-batch -d {} -s jobs --auth-mode key --account-name {} --subscription {} --pattern output/invoice/20220402/layoutlm-TT_MH5MSL1024_Tier1_FT2/layoutlm@2022-04-02_22-37-11/model_artifacts/model.onnx

This is the full command we're using.

For patterns not following the four cases(*, ?, [seq], [!seq]), we used to take it as a full blob name. And the latest CLI does have a bug here.

@evelyn-ys
Copy link
Member

@venkymns for specific blob file, you can use az storage blob download as workaround

@taoisu
Copy link
Author

taoisu commented Apr 7, 2022

When installing previous versions, please make sure all the dependencies of latest version are uninstalled. I'm afraid there's some storage dependency left.

I'm not sure if you just need to fix the latest CLI, because I've also tried installing previous versions (which works in the past), and I'm seeing the exactly the same issue.

What is interesting is that even if I install azure-cli=2.29.2-1~bionic freshly inside the docker image this exact same error would occur, any ideas why?

@taoisu
Copy link
Author

taoisu commented Apr 7, 2022

az storage blob download-batch -d {} -s jobs --auth-mode key --account-name {} --subscription {} --pattern output/invoice/20220402/layoutlm-TT_MH5MSL1024_Tier1_FT2/layoutlm@2022-04-02_22-37-11/model_artifacts/model.onnx

This is the full command we're using.

For patterns not following the four cases(*, ?, [seq], [!seq]), we used to take it as a full blob name. And the latest CLI does have a bug here.

I can understand that if the pattern is not working I might end up downloading the wrong files, but the callstack tells me that seems the API has been deleted or some wrong version of dependencies are installed. Are you sure this is related to the bug you are talking about?

@evelyn-ys
Copy link
Member

I can understand that if the pattern is not working I might end up downloading the wrong files, but the callstack tells me that seems the API has been deleted or some wrong version of dependencies are installed. Are you sure this is related to the bug you are talking about?

We upgraded the dependency Python SDK and the APIs have changed a lot. For patterns not following *, ?, [seq], [!seq], the API is unchanged so making the command fail

@taoisu
Copy link
Author

taoisu commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot customer-reported Issues that are reported by GitHub users external to the Azure organization. Storage az storage
Projects
None yet
3 participants