复制链接
克隆策略
In [3]:
import dai
In [2]:
help(dai.DataSource.write_zero)
Help on method write_zero in module dai.datasource:

write_zero(id: str) -> 'DataSource' method of builtins.type instance
    创建一个空的DataSource,并由用户自己管理
    
    Args:
        id (str): datasource id
    
    Returns:
        DataSource: datasource

In [5]:
ds = dai.DataSource.write_zero("testzero001")
In [8]:
with ds.mount() as path:
    # mount到本地 path,并自动 unmount
    print(f"{path=}")
path='/dai/1683896238847848622_testzero001'
In [9]:
# 手动unmount

mnt = ds.mount()

print(f"{mnt.path=}")

# 用完后 unmount
mnt.unmount()
mnt.path='/dai/1683896306046078685_testzero001'
In [10]:
# 删除这个测试DataSource
ds.delete()