BlueBrain / BlueBrain/nexus-python-sdk
Unable to update a registered file
- Ngôn ngữ chính
- Python
- Star
- 6
- Fork
- 10
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
### Expected behavior
After I registered a new file in nexus, I want to update the content of a file (create a new version).
### Actual Behavior (please include screenshot if possible)
When trying to update the file, I get the following error
```
tests/test_versioning.py:135: in test_register_update_file
self.update_file(nexus, config, file_id)
tests/test_versioning.py:59: in update_file
file_id = file_id, filepath=file_path2, rev=1)
../../../../Envs/nexus/src/nexus-python-sdk/nexussdk/files.py:173: in update
return http_put(path, body=file_obj, data_type="file", rev=rev, storage=storage_id)
../../../../Envs/nexus/src/nexus-python-sdk/nexussdk/utils/http.py:166: in http_put
response = requests.put(full_url, headers=header, files=body, params=kwargs)
../../../../Envs/nexus/lib/python3.6/site-packages/requests/api.py:131: in put
return request('put', url, data=data, **kwargs)
../../../../Envs/nexus/lib/python3.6/site-packages/requests/api.py:60: in request
return session.request(method=method, url=url, **kwargs)
../../../../Envs/nexus/lib/python3.6/site-packages/requests/sessions.py:533: in request
resp = self.send(prep, **send_kwargs)
../../../../Envs/nexus/lib/python3.6/site-packages/requests/sessions.py:646: in send
r = adapter.send(request, **kwargs)
../../../../Envs/nexus/lib/python3.6/site-packages/requests/adapters.py:498: in send
raise ConnectionError(err, request=request)
E requests.exceptions.ConnectionError: ('Connection aborted.', BrokenPipeError(32, 'Broken pipe'))
```
### Steps to reproduce the problem
1. I register a file 'brain.jpg' into nexus. That works, an ID example is https://staging.nexus.ocp.bbp.epfl.ch/v1/files/gpfs_tests/gpfs_tests/d7df3f2c-b5ea-431e-a75b-03760ac6dbbd
2. I try to update the version of that resource by using the python sdk as follows:
```
nexus.files.update(org_label="gpfs_tests", project_label="gpfs_tests", file_id = "https://staging.nexus.ocp.bbp.epfl.ch/v1/resources/gpfs_tests/gpfs_tests/_/d7df3f2c-b5ea-431e-a75b-03760ac6dbbd", filepath="/home/adietz/Work/10_NSE/1.10_gpfs_nexus/autotests/resources/DSC00728.JPG", rev=1)
```
This creates a `put` request for the url `http://staging.nexus.ocp.bbp.epfl.ch/v1/files/gpfs_tests/gpfs_tests/https%3A%2F%2Fstaging.nexus.ocp.bbp.epfl.ch%2Fv1%2Fresources%2Fgpfs_tests%2Fgpfs_tests%2F_%2F6272720f-0c5a-4691-a2ff-a01c4a8d8bce` with params = `{'rev': 1, 'storage': None}`
### Optional infrastructural data (user, platform, browser, environment, ...)
stage environment, org: "gpfs_tests", project: "gpfs_tests".
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu với tests/test_versioning.py, đặc biệt là test_register_update_file và update_file, sau đó lần theo request qua nexussdk/files.py và nexussdk/utils/http.py. Tái hiện việc cập nhật trên môi trường stage và kiểm tra PUT URL cùng các tham số được tạo ra. Hoàn tất khi việc cập nhật một file đã đăng ký tạo ra phiên bản mới được yêu cầu mà không xảy ra lỗi kết nối.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- api, backend
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100