Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Artifacts are not deleted from disk when running task cleanup #394

Open
waza-ari opened this issue Jan 3, 2025 · 0 comments
Open

Artifacts are not deleted from disk when running task cleanup #394

waza-ari opened this issue Jan 3, 2025 · 0 comments

Comments

@waza-ari
Copy link

waza-ari commented Jan 3, 2025

When running the purge_old_user_tasks task, the entries are correctly deleted from database, but the files remain orphan on the file system. The code is simply calling the delete() method on the UserTaskStatus model, which in turn deletes the related UserTaskArtifact models by cascading:

UserTaskStatus.objects.filter(created__lt=limit).delete()

This is most likely related to a change after Django 1.3:

In earlier Django versions, when a model instance containing a FileField was deleted, FileField took it upon itself to also delete the file from the backend storage. This opened the door to several data-loss scenarios, including rolled-back transactions and fields on different models referencing the same file. In Django 1.3, when a model is deleted the FileField’s delete() method won’t be called. If you need cleanup of orphaned files, you’ll need to handle it yourself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant