legate.core.experimental.io.file_handle.FileHandle#
- class legate.core.experimental.io.file_handle.FileHandle( )#
File handle for distributed IO.
- __init__( )#
Open file for distributed IO.
The file is opened in the constructor immediately and not in a Legate task. This means that re-opening a file that was created by a not-yet-executed Legate task requires a blocking fence like
get_legate_runtime().issue_execution_fence(block=True)
.- Additional limitations:
The file path to the file must not change while opened.
The file size can only be changed through this handle. That is, access to the file outside of this file handle is allowed as long as the file size doesn’t change.
Writing to the file using a file handle (e.g.
FileHandle.write
) is a deferred task thus in order to read the file at a later point, a blocking execution fence is required even when using the same file handle.
- Parameters:
file (Path | str) – Path-like object giving the pathname (absolute or relative to the current working directory) of the file to be opened.
flags (str, optional) – “r” -> open for reading (default) “r+” -> open for reading and writing “w” -> open for writing, truncating the file first “w+” -> open for reading and writing, truncating the file first “b” -> ignored, the file is always opened in binary mode
Attributes
File size in bytes.
Methods