-
Notifications
You must be signed in to change notification settings - Fork 135
Handle edge cases in task diagnostics handling #7068
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
Conversation
pulpcore/tasking/_util.py
Outdated
| artifact.save() | ||
| except IntegrityError: | ||
| artifact = Artifact.objects.get(sha256=artifact.sha256) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Want to see if I can reduce duplication between all of these.
pulpcore/tasking/_util.py
Outdated
| artifact = Artifact.init_and_validate(str(profile_file_path)) | ||
| with suppress(IntegrityError): | ||
| artifact.save() | ||
| with transaction.atomic(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the transaction really useful?
Let's assume the artifact.save works and the ProfileArtifact save fails, you roll back the transaction and now we have a file in storage without representation in the database. I think that'd be even worse than having created an orphaned artifact which in turn can eventually be properly cleaned up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point
d89308a to
326583c
Compare
When an Artifact fails to save (likely due to a memory report being identical between two tasks by chance), we should be handling the case instead of failing out faster. closes pulp#7020
Backport to 3.73: π cherry-picking failed β conflicts foundβ Failed to cleanly apply eda59a9 on top of patchback/backports/3.73/eda59a9e83e5726cd2b07066deb7dc5a0b53a7d5/pr-7068 Backporting merged PR #7068 into main
π€ @patchback |
Backport to 3.93: π backport PR createdβ
Backport PR branch: Backported as #7070 π€ @patchback |
Backport to 3.85: π backport PR createdβ
Backport PR branch: Backported as #7074 π€ @patchback |
When an Artifact fails to save (likely due to a memory report being identical between two tasks by chance), we should be handling the case instead of failing out faster.
closes #7020