ibridges.data_operations.download
- ibridges.data_operations.download(session, irods_path, local_path, overwrite=False, ignore_err=False, resc_name='', copy_empty_folders=True, options=None, dry_run=False)
Download a collection or data object to the local filesystem.
- Parameters:
session (
Session) – Session to download the collection from.irods_path (IrodsPath) – Absolute irods source path pointing to a collection
local_path (Path) – Absolute path to the destination directory
overwrite (bool) – If an error occurs during download, and ignore_err is set to True, any errors encountered will be transformed into warnings and iBridges will continue to download the remaining files. By default all errors will stop the process of downloading.
ignore_err (bool) – Collections: If download of an item fails print error and continue with next item.
resc_name (str) – Name of the resource from which data is downloaded, by default the server will decide.
copy_empty_folders (bool) – Create respective local directory for empty collections.
options (dict) – More options for the download
dry_run (
bool) – Whether to do a dry run before uploading the files/folders.
- Raises:
PermissionError: – If the iRODS server (for whatever reason) forbids downloading the file or (part of the) collection.
ValueError: – If the irods_path is not pointing to either a collection or a data object.
FileExistsError: – If the irods_path points to a data object and the local file already exists.
NotADirectoryError: – If the irods_path is a collection, while the destination is a file.
Examples
>>> download(session, "~/some_collection", "some_local_dir") >>> download(session, IrodsPath(session, "some_obj.txt"), "some_local_dir") >>> ops = download(session, "~/some_obj.txt", "some_local_dir", dry_run=True) >>> print(ops) {'create_dir': set(), 'create_collection': set(), 'upload': [], 'download': [(IrodsPath(~, some_obj.txt), PosixPath('some_local_dir'))], 'resc_name': '', 'options': None}