Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dralley
Copy link
Contributor

@dralley dralley commented Nov 6, 2025

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

artifact.save()
except IntegrityError:
artifact = Artifact.objects.get(sha256=artifact.sha256)

Copy link
Contributor Author

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.

@dralley dralley marked this pull request as ready for review November 6, 2025 15:15
artifact = Artifact.init_and_validate(str(profile_file_path))
with suppress(IntegrityError):
artifact.save()
with transaction.atomic():
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point

@dralley dralley force-pushed the 7020 branch 2 times, most recently from d89308a to 326583c Compare November 6, 2025 15:26
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
@dralley dralley merged commit eda59a9 into pulp:main Nov 6, 2025
13 checks passed
@patchback
Copy link

patchback bot commented Nov 6, 2025

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

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/pulp/pulpcore.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/3.73/eda59a9e83e5726cd2b07066deb7dc5a0b53a7d5/pr-7068 upstream/3.73
  4. Now, cherry-pick PR Handle edge cases in task diagnostics handlingΒ #7068 contents into that branch:
    $ git cherry-pick -x eda59a9e83e5726cd2b07066deb7dc5a0b53a7d5
    If it'll yell at you with something like fatal: Commit eda59a9e83e5726cd2b07066deb7dc5a0b53a7d5 is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x eda59a9e83e5726cd2b07066deb7dc5a0b53a7d5
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR Handle edge cases in task diagnostics handlingΒ #7068 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/3.73/eda59a9e83e5726cd2b07066deb7dc5a0b53a7d5/pr-7068
  7. Create a PR, ensure that the CI is green. If it's not β€” update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry β€” they'll tell you if
    any improvements are necessary when the time comes!

πŸ€– @patchback
I'm built with octomachinery and
my source is open β€” https://github.com/sanitizers/patchback-github-app.

@dralley dralley deleted the 7020 branch November 6, 2025 17:42
@patchback
Copy link

patchback bot commented Nov 6, 2025

Backport to 3.93: πŸ’š backport PR created

βœ… Backport PR branch: patchback/backports/3.93/eda59a9e83e5726cd2b07066deb7dc5a0b53a7d5/pr-7068

Backported as #7070

πŸ€– @patchback
I'm built with octomachinery and
my source is open β€” https://github.com/sanitizers/patchback-github-app.

@patchback
Copy link

patchback bot commented Nov 10, 2025

Backport to 3.85: πŸ’š backport PR created

βœ… Backport PR branch: patchback/backports/3.85/eda59a9e83e5726cd2b07066deb7dc5a0b53a7d5/pr-7068

Backported as #7074

πŸ€– @patchback
I'm built with octomachinery and
my source is open β€” https://github.com/sanitizers/patchback-github-app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PULP-938] Pulp sync task is getting stuck

2 participants