8000 Ignore errors when removing snapshot directory by engelmi · Pull Request #1511 · containers/ramalama · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Ignore errors when removing snapshot directory #1511

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

Merged

Conversation

engelmi
Copy link
Member
@engelmi engelmi commented Jun 12, 2025

Relates to: #1508

remove_snapshot should never fail and, therefore, the shutil.rmtree call needs ignore_errors=True.

/cc @olliewalsh

Summary by Sourcery

Bug Fixes:

  • Make shutil.rmtree in remove_snapshot use ignore_errors=True to silently ignore deletion errors

Copy link
Contributor
sourcery-ai bot commented Jun 12, 2025

Reviewer's Guide

Adjusted the remove_snapshot implementation so the snapshot directory cleanup never fails by enabling error suppression in the rmtree call.

Updated Class Diagram: ModelStore

classDiagram
    class ModelStore {
        +remove_snapshot(model_tag: str)
    }
    note for ModelStore "Implementation of remove_snapshot changed to ignore errors from shutil.rmtree."
Loading

File-Level Changes

Change Details Files
Enable ignore_errors on directory removal
  • Changed shutil.rmtree(ignore_errors=False) to ignore_errors=True
ramalama/model_store.py

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor
@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @engelmi - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@engelmi engelmi force-pushed the ignore-rm-of-non-existing-snapshot-dir branch from 2aa89e6 to 5f68492 Compare June 12, 2025 11:19
Relates to: containers#1508

remove_snapshot should never fail, therefore adding the ignore_errors=True.
Before removing a snapshot with ramalama rm an existence check is made. If
the model does not exist, an error will be raised to preserve the previous
behavior of that command.

Signed-off-by: Michael Engel <mengel@redhat.com>
@engelmi engelmi force-pushed the ignore-rm-of-non-existing-snapshot-dir branch from 5f68492 to 830409e Compare June 12, 2025 11:31
@ericcurtin
Copy link
Collaborator

LGTM... Will this fix or partially fix the issue @cedricclyburn saw? Was this tested?

@ericcurtin ericcurtin merged commit 12b37d6 into containers:main Jun 12, 2025
15 checks passed
@engelmi
Copy link
Member Author
engelmi commented Jun 12, 2025

LGTM... Will this fix or partially fix the issue @cedricclyburn saw? Was this tested?

The failure to remove the snapshot directory is a subsequent error - and this PR makes the model store a bit more resilient. The failure in #1508 is due to the fallback to the hf cli, which we don't support multi-modal models. Ramalama uses the fallback probably due to an API error (rate limiting?) in the first, multi-modal supporting method.

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

Successfully merging this pull request may close these issues.

2 participants
0