Reference
platform.file_api
¶
API to interact with the tools API. To list available methods in this module, use:
from deeporigin.platform import file_api
file_api.__all__
src.platform.file_api
¶
bridge module to interact with the platform files api
Attributes¶
Functions¶
download_file
¶
download_file(
*,
remote_path: str,
local_path: Optional[str] = None,
client=None
)
download a single file from UFA to ~/.deeporigin/, or some other local path
Parameters:
Name | Type | Description | Default |
---|---|---|---|
remote_path
|
str
|
The remote path of the file to download. |
required |
local_path
|
str
|
The local path to save the file to. If None, uses ~/.deeporigin/. |
None
|
download_files
¶
download_files(
files: dict[str, str | None], *, client=None
)
Download multiple files in parallel. files: {remote_path: local_path or None}. If local_path is None, use default. Raises RuntimeError if any download fails.
list_files_in_dir
¶
list_files_in_dir(file_path: str, *, client=None) -> list
Find files on the UFA (Unified File API) storage in some directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path
|
str
|
The path to the directory to list files from. |
required |
client
|
FilesApi
|
The client to use to list files. |
None
|
Returns:
Type | Description |
---|---|
list
|
List[str]: A list of file paths found in the specified UFA directory. |
upload_file
¶
upload_file(
*,
local_path: str | Path,
remote_path: str | Path,
client=None
)
upload a single file to UFA
Parameters:
Name | Type | Description | Default |
---|---|---|---|
local_path
|
str
|
The local path of the file to upload. |
required |
remote_path
|
str
|
The remote path of the file to upload. |
required |
upload_files
¶
upload_files(files: dict[str, str], *, client=None)
Upload multiple files in parallel. files: {local_path: remote_path}. Raises RuntimeError if any upload fails.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
files
|
dict[str, str]
|
A dictionary of local paths to remote paths. |
required |