Skip to content

Stop Accessioning in Progress

Peter Mangiafico edited this page Oct 12, 2023 · 6 revisions

Sometimes objects that have started accessioning fail part way and and it is easier to just start over again instead of fixing the problem. This requires "resetting" the current version (which could be the initial/first version) in accessioning by deleting some active workflows, removing content from workspace directories, etc. A rake task is provided for this purpose, both for a single druid or for a set of druids provided in a CSV file. In both cases, some checks are performed first to ensure the version of the druids are "resettable" (i.e. not fully accessioned yet).

To run for a single druid, on the DSA app server:

RAILS_ENV=production bundle exec rake cleanup:stop_accessioning['druid:ab123bc4567']

You can add :dryrun if you want to view output only and not actually perform the actions:

RAILS_ENV=production bundle exec rake cleanup:stop_accessioning['druid:ab123bc4567',:dryrun]

In both cases, a confirmation prompt is provided and then checks are performed before any actions are run.

To run a set of druids, create a CSV/txt file with no header and one druid per line. Then, on the DSA server:

RAILS_ENV=production bundle exec rake cleanup:bulk_stop_accessioning['tmp/druids.csv']

You can also add :dryrun if you want to view output only and not actually perform the actions (same as above for single druid).

H2 Items

If the object was an H2 item, the H2 app also needs to reset the item back into draft. This is not done from the rake task (which does not have access to the H2 database). This should be done separately as shown below: (Note: the full process is also described here https://github.com/sul-dlss/happy-heron/wiki/Fix-a-draft-an-item-stuck-in-accessioning but some of the steps in that wiki page are taken care of by the rake task, so if you have used the rake task above, you only need reset the state as shown below).

On the H2 rails console:

Work.find_by(druid: 'druid:ab123bc4567').head.update(state: 'first_draft')