ibridges.data_operations.sync
- ibridges.data_operations.sync(session, source, target, max_level=None, dry_run=False, ignore_err=False, copy_empty_folders=False, resc_name='', options=None)
Synchronize the data between a local copy (local file system) and the copy stored in iRODS.
The command can be in one of the two modes: synchronization of data from the client’s local file system to iRODS, or from iRODS to the local file system. The mode is determined by the type of the values for source and target (IrodsPath or str/Path).
The command considers the file size and the checksum to determine whether a file should be synchronized.
- Parameters:
session (ibridges.Session) – An authorized iBridges session.
source (str or Path or IrodsPath) – Existing local folder or iRODS collection. An exception will be raised if it doesn’t exist.
target (str or Path or IrodsPath) – Existing local folder or iRODS collection. An exception will be raised if it doesn’t exist.
max_level (int, default None) – Controls the depth up to which the file tree will be synchronized. A max level of 1 synchronizes only the source’s root, max level 2 also includes the first set of subfolders/subcollections and their contents, etc. Set to None, there is no limit (full recursive synchronization).
dry_run (bool, default False) – List all source files and folders that need to be synchronized without actually performing synchronization.
ignore_err (If an error occurs during the transfer, and ignore_err is set to True,) – any errors encountered will be transformed into warnings and iBridges will continue to transfer the remaining files.
copy_empty_folders (bool, default False) – Controls whether folders/collections that contain no files or subfolders/subcollections will be synchronized.
resc_name (str) – Name of the resource from which data is downloaded, by default the server will decide.
options (dict) – More options for the download/upload
- Return type:
dict- Returns:
- A dict object containing four keys:
’create_dir’ : Create local directories when sync from iRODS to local ‘create_collection’ : Create collections when sync from local to iRODS ‘upload’ : Tuple(local path, iRODS path) when sync from local to iRODS ‘download’ : Tuple(iRODS path, local path) when sync from iRODS to local
(or of to-be-changed folders and files, when in dry-run mode).