Skip to content

feat(storage): 添加阿里云OSS存储支持#5037

Open
zyfjrx wants to merge 2 commits intoPaddlePaddle:developfrom
zyfjrx:support-aliyun-oss
Open

feat(storage): 添加阿里云OSS存储支持#5037
zyfjrx wants to merge 2 commits intoPaddlePaddle:developfrom
zyfjrx:support-aliyun-oss

Conversation

@zyfjrx
Copy link
Copy Markdown

@zyfjrx zyfjrx commented Mar 6, 2026

  • 在导出列表中增加OSSConfig和OSS类
  • 新增OSSConfig配置模型,包含endpoint、access_key等字段
  • 扩展FileStorageConfig联合类型以支持OSS配置
  • 实现OSS存储类,继承Storage基类
  • 添加OSS初始化方法,创建认证和Bucket对象
  • 实现get、set、delete、get_url等存储操作方法
  • 添加私有_get_full_key方法处理键前缀逻辑
  • 在create_storage工厂函数中添加OSS实例创建分支
  • 使用装饰器class_requires_deps确保oss2依赖可用

- 在导出列表中增加OSSConfig和OSS类
- 新增OSSConfig配置模型,包含endpoint、access_key等字段
- 扩展FileStorageConfig联合类型以支持OSS配置
- 实现OSS存储类,继承Storage基类
- 添加OSS初始化方法,创建认证和Bucket对象
- 实现get、set、delete、get_url等存储操作方法
- 添加私有_get_full_key方法处理键前缀逻辑
- 在create_storage工厂函数中添加OSS实例创建分支
- 使用装饰器class_requires_deps确保oss2依赖可用
@paddle-bot
Copy link
Copy Markdown

paddle-bot bot commented Mar 6, 2026

Thanks for your contribution!

@paddle-bot paddle-bot bot added the contributor External developers label Mar 6, 2026
key = self._get_full_key(key)
self._bucket.delete_object(key)

def get_url(self, key: str) -> str:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最新的接口允许指定超时时间,可以适配一下


super().__init__()

# 创建认证对象
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议统一使用英文注释

return key


@class_requires_deps("oss2")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新增了依赖,可能需要确认一下是否能通过pre-commit检查

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants