Last active
August 29, 2015 14:04
-
-
Save mbklein/87ee43f169b0b69a6ae1 to your computer and use it in GitHub Desktop.
How to restart a hung MasterFile in Matterhorn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
empty = ActiveFedora::SimpleDatastream.xml_template.to_xml | |
mf = MasterFile.find(pid) # Load the MasterFile. | |
if mf.workflow_id.present? | |
begin | |
Rubyhorn.client.stop(mf.workflow_id) # Stop the existing workflow. | |
rescue # Keep going even if stopping the workflow fails. | |
end # This means there might be more cleanup later. | |
end | |
mf.mhMetadata.content = empty # Remove all Matterhorn-related fields. | |
mf.set_workflow # Reset the proper workflow. | |
mf.save # Save the MasterFile so delayed_job can find it. | |
mf.process # Re-submit the job to Matterhorn via delayed_job. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment