eprintsug / EPrintsArchivematica

Digital Preservation through EPrints-Archivematica Integration - An EPrints export plugin to Archivematica
6 stars 1 forks source link

delete_transfers bin script? #39

Closed photomedia closed 2 years ago

photomedia commented 2 years ago

Do we need a "delete_transfers" bin script that will clear/delete any or some specific existing archivematica objects?

geo-mac commented 2 years ago

Something akin to a delete_transfers bin script would be very helpful indeed -- and apologies for not documenting this issue sooner.

Deleting transfers can be necessary during testing and troubleshooting but may also be necessary if there is some reason a repository wishes to re-export repository content for Archivematica ingest. The latter scenario is what I am confronting at the moment. I need to re-export a portion of repository content to a separate storage location and it would be helpful to destroy all the existing records and simply re-export from scratch. This cannot be done without destroying the existing transfer records -- which can only be achieved by deleting them individually (which is unscalable for > 10 records or thereabouts), or by uninstalling and reinstalling the plugin software.

photomedia commented 2 years ago

Hi @geo-mac , how about if we add a --delete flag to "touch_transfers" script instead of creating another one? Instead of setting or unsetting the "Needs update", running touch_transfers --delete would delete the transfer. Adding the flag would mean that we don't have to maintain a copy of the part of the script that finds the transfer.

photomedia commented 2 years ago

I was able to add a --delete flag to the touch_transfers script. I will commit that change soon.
To note is that to delete the transfer, I would call: $am->delete(); And this deletes the object using this API call: https://wiki.eprints.org/w/API:EPrints/DataObj#delete The only thing is that the AMID for the deleted object would not be reused. Therefore, if you had 500 transfer objects with AMIDs 1-500, after deleting them all, the next time you create a transfer, it would have the AMID 501. I think that actually makes sense, but let me know if that's an issue.

photomedia commented 2 years ago

I added the --delete flag touch_transfers and updated the README.

geo-mac commented 2 years ago

Terrific work @photomedia -- and apologies for another slow response to repo updates!

The only thing is that the AMID for the deleted object would not be reused. Therefore, if you had 500 transfer objects with AMIDs 1-500, after deleting them all, the next time you create a transfer, it would have the AMID 501. I think that actually makes sense, but let me know if that's an issue.

I agree. I do not envisage any issues with this and will deploy it imminently for testing.

Great work.