This API supports only the MindSpore framework.
with is used to call create_file to create a file and return the corresponding _WriteableFileWrapper instance. The instance provides the write(), drop(), and close() methods.
write(self, data: bytes)
Parameter |
Mandatory/Optional |
Description |
Value |
|---|---|---|---|
data |
Mandatory |
Object to be written |
bytes object |
drop(self)
close(self)
mindio_acp.create_file(path: str, mode: int = 0o600)
Parameter |
Mandatory/Optional |
Description |
Value |
|---|---|---|---|
path |
Mandatory |
Data storage path |
Valid file path |
mode |
Optional |
File creation permission |
[0o000, 0o777] |
>>> x = b'\x00\x01\x02\x03\x04'
>>> with mindio_acp.create_file('/mnt/dpc01/checkpoint/rank-0.pt') as f:
... write_result = f.write(x)