ibridges.data_operations.upload
- ibridges.data_operations.upload(session, local_path, irods_path, overwrite=False, ignore_err=False, resc_name='', copy_empty_folders=True, options=None, dry_run=False)
Upload a local directory or file to iRODS.
- Parameters:
session (
Session) – Session to upload the data to.local_path (Path) – Absolute path to the directory to upload
irods_path (IrodsPath) – Absolute irods destination path
overwrite (bool) – If data object or collection already exists on iRODS, overwrite
ignore_err (bool) – If an error occurs during upload, and ignore_err is set to True, any errors encountered will be transformed into warnings and iBridges will continue to upload the remaining files. By default all errors will stop the process of uploading.
resc_name (str) – Name of the resource to which data is uploaded, by default the server will decide
copy_empty_folders (bool) – Create respective iRODS collection for empty folders. Default: True.
options (dict) – More options for the upload
dry_run (
bool) – Whether to do a dry run before uploading the files/folders.
- Raises:
ValueError: – If the local_path is not a valid filename of directory.
PermissionError: – If the iRODS server does not allow the collection or data object to be created.
Examples
>>> ipath = IrodsPath(session, "~/some_col") >>> upload(session, Path("dir"), ipath) >>> upload(session, Path("dir"), ipath, overwrite=True) >>> ops = upload(session, Path("some_file.txt"), ipath, dry_run) # Does not upload >>> print(ops) {'create_dir': set(), 'create_collection': set(), 'upload': [(PosixPath('some_file.txt'), IrodsPath(~, some_col))], 'download': [], 'resc_name': '', 'options': None}