Azure / Azure/azure-storage-python
Unable to load serialized object persisted on Azure Blob storage
- Ngôn ngữ chính
- Python
- Star
- 343
- Fork
- 243
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
We serialize the 'pipeline' object and store it on Azure Blob Storage.
```
with open("feg_pipeline.pkl", 'wb') as f:
dill.dump(pipeline, f, protocol=pickle.HIGHEST_PROTOCOL)
blob_service_client = BlobServiceClient.from_connection_string(conn_str=‘XXX’)
container_name = ‘YYY’
blob_service_client.create_container(container_name, public_access=PublicAccess.Container)
blob_client = blob_service_client.get_blob_client(
container=container_name, blob='feg_pipeline.pkl')
blob_client.upload_blob('feg_pipeline.pkl')
```
Later in a different function we read this from Blob storage as follows -
```
blob = BlobClient(account_url='https://fhghjhjh’,
container_name=‘YYY’,
blob_name='feg_pipeline.pkl’,
credential=‘XXX’)
feg_from_blob = None
with open("feg_pipeline.pkl”, "wb") as f:
data = blob.download_blob()
data.readinto(f)
with open("feg_pipeline.pkl”, "rb") as f:
feg_from_blob = dill.load(f)
```
For this we are getting
```
UnpicklingError: invalid load key, 'f'.
```
We have tried using -
Dill, Joblib, cPickle, CloudPickle and Pickle methods for serializing and deserializing, all of these gave keyerror while loading the object from the file downloaded from Blob.
Base64 encoding(while serializing) and decoding(while deserializing)..This gives a padding error while loading.
**What is the best way to persist and reuse such objects in Azure?**
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách xem lại các lệnh gọi Azure BlobClient upload_blob và download_blob được nêu trong issue, sau đó tái hiện luồng tuần tự hóa và tải xuống bằng ví dụ dill được cung cấp. So sánh các byte được ghi vào feg_pipeline.pkl trước và sau round trip qua Blob Storage, đồng thời xác định nguyên nhân gây ra UnpicklingError. Hoàn thành có nghĩa là đã hiểu luồng lưu trữ bền vững và có sẵn một bản sửa lỗi được ghi lại, có thể tái hiện.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- azure, python
- Lĩnh vực
- cloud
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 20/100