Usage¶
Invenio 3 module to connect Invenio to Archivematica.
Customization¶
Factories¶
Factories used to customize the behavior of the module.
-
invenio_archivematica.factories.
create_accession_id
(ark)[source]¶ Create an accession ID to store the sip in Archivematica.
Parameters: ark ( invenio_archivematica.models.Archive
) – the archiveReturns: the created ID: SERVICE-SIP_UUID Return type: str
-
invenio_archivematica.factories.
is_archivable_default
(sip)[source]¶ Tell if the given sip should be archived or not.
If this function returns True, the sip will be archived later. Otherwise, the sip will never get archived.
This function returns the archived flag on the SIP.
-
invenio_archivematica.factories.
transfer_cp
(uuid, config)[source]¶ Transfer the files contained in the sip to a local destination.
The transfer is done with a simple copy of files.
This method is automatically called by the module to transfer the files. Depending on your installation, you may want to have a different behavior (copy among servers...). Then, you can create your own factory and link it into the config variable
invenio_archivematica.config.ARCHIVEMATICA_TRANSFER_FACTORY
.Parameters: - uuid (str) – the id of the sip containing files to transfer
- config – can be empty. It will have the content of the variable
invenio_archivematica.config.ARCHIVEMATICA_TRANSFER_FOLDER
. However, it will use the export folder set ininvenio_sipstore.config.SIPSTORE_ARCHIVER_LOCATION_NAME
-
invenio_archivematica.factories.
transfer_demo
(uuid, config)[source]¶ Transfer the files contained in the sip to the destination.
Very similar to the rsync transfer. However, because of time, I use the VERY UNSECURE sshpass package for rsync authentication. DO NOT USE IN PROD!!!
Parameters: - uuid (str) – the id of the sip containing files to transfer
- config (dict) – here config must be a dict with the following keys: - user - the SSH user - password_file - a path where the password is stored - remote - the URL or IP of the remote - remote_path - where to store files on the remote - args - the args for rsync
-
invenio_archivematica.factories.
transfer_rsync
(uuid, config)[source]¶ Transfer the files contained in the sip to the destination.
The transfer is done with a rsync. If transfer to remote, you need a valid ssh setup.
This method is automatically called by the module to transfer the files. Depending on your installation, you may want to have a different behavior (copy among servers...). Then, you can create your own factory and link it into the config variable
invenio_archivematica.config.ARCHIVEMATICA_TRANSFER_FACTORY
.The config needs to include at least the destination folder. If transfer to remote, it needs to include the user and the server. In either cases, you can include usual rsync parameters. See
invenio_archivematica.config.ARCHIVEMATICA_TRANSFER_FOLDER
:ARCHIVEMATICA_TRANSFER_FOLDER = { 'server': 'localhost', 'user': 'invenio', 'destination': '/tmp', 'args': '-az' }
Parameters: - uuid (str) – the id of the sip containing files to transfer
- config – the config for rsync
Tasks¶
Tasks used by invenio-archivematica.
.... autotask:: invenio_archivematica.tasks.oais_start_transfer .... autotask:: invenio_archivematica.tasks.oais_process_transfer .... autotask:: invenio_archivematica.tasks.oais_finish_transfer .... autotask:: invenio_archivematica.tasks.oais_fail_transfer .... autotask:: invenio_archivematica.tasks.archive_new_sips