perago.workspace_local_path#

perago.workspace_local_path(workspace_spec, object_path)[源代码]#

Map a LakeFS object path to a local workspace path.

The workspace prefix is removed from visible remote paths before they are exposed to the task body. Objects outside the prefix remain invisible to the local attempt workspace.

Parameters:
workspace_specWorkspaceSpec

Workspace declaration whose prefix defines the visible LakeFS object subtree.

object_pathstr or os.PathLike[str]

LakeFS object path to map into the local attempt workspace.

Returns:
pathlib.Path or None

Workspace-relative local path when the object is inside the prefix. None is returned for objects outside the prefix and for Perago's attempt marker file.

Raises:
TaskDefinitionError

If object_path is not a safe relative POSIX path.

参数:
返回类型:

Path | None

参见

workspace_download_files

Build download records from object paths.

WorkspaceSpec

Declares the workspace prefix.

Examples

>>> workspace_local_path(WorkspaceSpec(prefix="/audio/render"), "audio/render/raw/input.wav")
PosixPath('raw/input.wav')
>>> workspace_local_path(WorkspaceSpec(prefix="/audio/render"), "other/raw/input.wav") is None
True