Story #3226
closedStory #3209: As a user, I have Repository Versions
As a user, I am guaranteed that my incomplete repository versions are cleaned up after a crash
100%
Description
Motivation¶
A RepositoryVersion that has complete=False and experiences an error will be deleted by core, then exception will be reraised, and the user will see the exception in the task failure. In the event of a crash though, we have no mechanism to clean up the incomplete RepositoryVersion. This would be an area of improvement.
Design¶
Storing crash info for cleanup later¶
The created_resources
field stores a reference to the created RepositoryVersion
. Any time a RepositoryVersion is created, it needs to be saved as a created_resources
object in the same transaction.
Cleaning up¶
Update the task cleanup code to delete any task.created_resources.filter(complete=False)
That worker already holds the necessary locks to make this operation safe so it just needs to make sure to perform the deletions before deleting the corresponding ReservedResource records.
created_resources only show resources with completed=True¶
A saved reference in created_resources
is only visible on the Task's viewset or filterset if completed=True.
Files
Related issues
Clean up incomplete created-resources. closes #3226