Modelarts sdk进行桶操作
【摘要】 # https://support.huaweicloud.com/sdk-python-devg-obs/obs_22_0703.htmlfrom modelarts.session import Session# from modelarts.model import Model# from modelarts.config.model_config import ServiceConf...
# https://support.huaweicloud.com/sdk-python-devg-obs/obs_22_0703.html from modelarts.session import Session # from modelarts.model import Model # from modelarts.config.model_config import ServiceConfig,Params,Dependencies,Packages session = Session(username='xxx', password='xxxx', region_name='cn-north-x') #创建桶 bucket_name = session.create_bucket(bucket="model-data1") #上传单个文件到桶 # session.create_directory(bucket="/model-data1/",directory = "mnist") session.upload_data(bucket_path="/model-data1/mnist/", path="/data/") # #上传多个文件 # local_file_list = ["/home/user/sdk1.txt", "/opt/sdk2.txt", "/etc/sdk3.txt"] # session.upload_data(bucket_path="/bucket-name/dir1/", path=local_file_list) # # #上传文件夹至桶 # session.upload_data(bucket_path="/bucket-name/dir1/", path="/home/user/sdk/") # #下载文件 # session.download_data(bucket_path="/bucket-name/dir1/sdk.txt", path="/home/user/sdk/obs.txt") # #下载文件夹 # session.download_data(bucket_path="/bucket-name/dir1/", path="/home/user/sdk/") # #在OBS中创建文件夹 # session.create_directory(bucket="bucket-name",directory = "/dir1/dir2/") # #删除桶 # session.delete_bucket(bucket="bucket-name")
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)