Unable to update a registered file

未关闭
#85 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
api, backend

调研方向

从 tests/test_versioning.py 开始,重点查看 test_register_update_file 和 update_file,然后跟踪请求经过 nexussdk/files.py 和 nexussdk/utils/http.py 的过程。在 stage 环境中重现更新操作,并检查生成的 PUT URL 和参数。完成的标准是:更新已注册的文件能够创建所请求的新版本,且不会出现连接错误。

由索引模型根据 Issue 内容生成。

描述

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".

主要语言
Python
星标
6
派生
10
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

BlueBrain/nexus-python-sdk 的其他 Issue

查看 BlueBrain/nexus-python-sdk 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。