Story #3226
Updated by bmbouter almost 7 years ago
h2. 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. h2. Design Add an attribute to RepositoryVersion called <code>task</code> that is a: <code>ForeignKey('Task', null=True, backref='repo_version')</code> This attribute <code>task</code>would be visible in the RepositoryVersion serializer The backref <code>repo_version</code> attribute would *not* be visible on the Task serializer Have "the task cleanup code":https://github.com/bmbouter/pulp/blob/74bf37e25049dd6c4f15b352f689f3d763cdba1b/pulpcore/pulpcore/tasking/services/worker_watcher.py#L139-L161 delete all of the associated repository versions. publishers. 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.