Paths¶
EFS path utilities.
get_efs_path ¶
get_efs_path(
local_path: Path,
raise_if_unresolved: Literal[False],
mount_points: Optional[
List[MountPointConfiguration]
] = None,
) -> Optional[EFSPath]
get_efs_path(
local_path: Path,
raise_if_unresolved: Literal[True] = True,
mount_points: Optional[
List[MountPointConfiguration]
] = None,
) -> EFSPath
get_efs_path(
local_path, raise_if_unresolved=True, mount_points=None
)
Converts a local path assumed to be on a mount point to the EFS path
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
local_path
|
Path
|
Local path |
required |
raise_if_unresolved
|
bool
|
If True, raises an error if the local path is not under an identifiable mount point. Defaults to True. |
True
|
mount_points
|
List[MountPointConfiguration] | None
|
Optionally can override list of mount_points. If None, mount points are detected. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
Optional[EFSPath]
|
Corresponding EFS URI or None if the path cannot be resolved and raise_if_unresolved is False |
Source code in src/aibs_informatics_aws_utils/efs/paths.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
get_local_path ¶
get_local_path(
efs_path: EFSPath,
raise_if_unmounted: Literal[False],
mount_points: Optional[
List[MountPointConfiguration]
] = None,
) -> Optional[Path]
get_local_path(
efs_path: EFSPath,
raise_if_unmounted: Literal[True] = True,
mount_points: Optional[
List[MountPointConfiguration]
] = None,
) -> Path
get_local_path(
efs_path, raise_if_unmounted=True, mount_points=None
)
Gets a valid locally mounted path for the given EFS path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
efs_path
|
EFSPath
|
The EFS path. e.g., "efs://fs-12345678:/path/to/file.txt" |
required |
raise_if_unmounted
|
bool
|
If True, raises an error if the EFS path is not mounted locally. Defaults to True. |
True
|
mount_points
|
List[MountPointConfiguration] | None
|
Optionally can override list of mount points. If None, mount points are detected. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
Optional[Path]
|
The local path. e.g., "/mnt/efs/path/to/file.txt" or None if the path cannot be resolved and raise_if_unmounted is False |
Source code in src/aibs_informatics_aws_utils/efs/paths.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |