Azure / Azure/azure-storage-python

When using user-defined retry callback, StorageClient._perform_request trips over undefined attribute context.count

オープン
#568 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
343
フォーク
243
PR マージ指標
30日以内にマージされた PR はありません

説明

### Which service(blob, file, queue) does this issue concern?
blob

### Which version of the SDK was used? Please provide the output of `pip freeze`.
azure-batch==6.0.0
azure-common==1.1.18
azure-storage-blob==1.4.0
azure-storage-common==1.4.0
azure-storage-file==1.4.0

### What problem was encountered?
I defined a retry callback and set client.retry to use it. After the first retry callback on the error being handled (status=409), wherein my callback returned 10, I get the error shown below.

### Analysis
_perform_request seems to be treating context.count field as a non-required but recognized property (line 391), but then references it unconditionally (line 418). If it is going to be referenced like this, it should probably just become a standard property of RetryContext class. As it is, its hard for a developer writing their own retry callback to know about this dependency.

### Stack Trace
traceback (most recent call last):
File "xt_test.py", line 114, in
store_test(xt)
File "xt_test.py", line 21, in store_test
xt.create_workspace(ws_name)
File "c:\github\ExperimentTools\xt\xt_store.py", line 65, in create_workspace
self.helper.create_workspace(ws_name, description)
File "c:\github\ExperimentTools\xt\xt_azure_store_blob.py", line 85, in create_workspace
result = self.bs.create_container(ws_name)
File "C:\Users\Roland\AppData\Local\Continuum\anaconda3\envs\exper\lib\site-packages\azure\storage\blob\baseblobservice.py", line 630, in create_container
self._perform_request(request, expected_errors=[_CONTAINER_ALREADY_EXISTS_ERROR_CODE])
File "C:\Users\Roland\AppData\Local\Continuum\anaconda3\envs\exper\lib\site-packages\azure\storage\common\storageclient.py", line 418, in _perform_request
retry_context.count,
AttributeError: 'RetryContext' object has no attribute 'count'

### Have you found a mitigation/solution?
Once you know to do it, a "count" property set to 0 can just be created on the retry_context argument of the custom retry callback.

Note: for table service, please post the issue here instead: https://github.com/Azure/azure-cosmosdb-python.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

azure/storage/common/storageclient.py を起点に、特に391行目と418行目付近の _perform_request を確認し、ユーザー定義の retry callback に対する RetryContext の扱いを調べてください。10を返す callback で blob-service の retry path を再現します。完了条件は、callback が context.count の欠如による AttributeError を引き起こさなくなることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
azure, python
領域
cloud
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。