perago.workspace_download_files#
- perago.workspace_download_files(workspace_dir, workspace_spec, object_paths)[源代码]#
Build download records for objects visible to a workspace task.
Download planning applies the task's workspace prefix before constructing local destination paths. The returned records are enough for runtime code to fetch object contents without exposing prefix-outside paths to task code.
- Parameters:
- workspace_dirpathlib.Path
Attempt-local workspace root where files should be written.
- workspace_specWorkspaceSpec
Workspace declaration whose
prefixfilters the remote object list.- object_pathslist of str
LakeFS object paths listed from the input workspace ref.
- Returns:
- list of WorkspaceDownloadFile
Download records sorted by object path. Objects outside the prefix and Perago's attempt marker file are omitted.
- Raises:
- TaskDefinitionError
If any object path cannot be represented as a safe workspace path.
- 参数:
workspace_dir (Path)
workspace_spec (WorkspaceSpec)
- 返回类型:
参见
workspace_local_pathMap one object path to a local path.
Examples
>>> files = workspace_download_files( ... workspace_dir, ... WorkspaceSpec(prefix="/audio/render"), ... ["audio/render/raw/input.wav", "other/input.wav"], ... ) >>> [file.local_path.relative_to(workspace_dir).as_posix() for file in files] ['raw/input.wav']