Drive¶
- class lightning.app.storage.drive.Drive(id, allow_duplicates=False, component_name=None, root_folder=None)[source]¶
Bases:
object
The Drive object provides a shared space to write and read files from.
When the drive object is passed from one component to another, a copy is made and ownership is transferred to the new component.
- Parameters:
allow_duplicates¶ (
bool
) – Whether to enable files duplication between components.component_name¶ (
Optional
[str
]) – The component name which owns this drive. When not provided, it is automatically inferred by Lightning.root_folder¶ (
Optional
[str
]) – This is the folder from where the Drive perceives the data (e.g this acts as a mount dir).
- delete(path)[source]¶
This method enables to delete files under the provided path from the Drive in a blocking fashion. Only the component which added a file can delete them.
- get(path, component_name=None, timeout=None, overwrite=False)[source]¶
This method enables to get files under the provided path from the Drive in a blocking fashion.
- Parameters:
path¶ (
str
) – The relative path you want to list files from the Drive.component_name¶ (
Optional
[str
]) – By default, the Drive get the matching files across all components. If you provide a component name, the matching is specific to this component.timeout¶ (
Optional
[float
]) – Whether to wait for the files to be available if not created yet.overwrite¶ (
bool
) – Whether to override the provided path if it exists.
- Return type: