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

Add endpoint for emptying the model cache #7602

Merged
merged 2 commits into from
Jan 30, 2025
Merged

Conversation

RyanJDick
Copy link
Collaborator

@RyanJDick RyanJDick commented Jan 28, 2025

Summary

This PR adds a backend endpoint that can be used to empty the model cache (to free RAM / VRAM). 'Locked' models that are actively being used will not be dropped.

Locking was added to ModelCache to make it thread-safe. But, I suspect that it might be possible to trigger #7513 with an ill-timed request to empty the cache (in the middle of graph execution). Even if this does happen, the current graph execution would fail, but subsequent graph executions should recover smoothly.

QA Instructions

I tested that the new endpoint successfully empties the model cache with curl -X POST 127.0.0.1:9090/api/v2/models/empty_model_cache.

I tried to break things by hitting the endpoint throughout graph execution. Nothing broke, which is a good sign. Of course, this is far from testing the thread interactions thoroughly.

Merge Plan

No special instructions.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions bot added api python PRs that change python files backend PRs that change backend files frontend PRs that change frontend files labels Jan 28, 2025
@RyanJDick RyanJDick force-pushed the ryan/empty-model-cache branch from 3c2a65a to 3613ee3 Compare January 28, 2025 19:44
@RyanJDick RyanJDick marked this pull request as ready for review January 28, 2025 19:46
@hipsterusername hipsterusername enabled auto-merge (rebase) January 30, 2025 14:16
@hipsterusername hipsterusername merged commit 64475b8 into main Jan 30, 2025
15 checks passed
@hipsterusername hipsterusername deleted the ryan/empty-model-cache branch January 30, 2025 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api backend PRs that change backend files frontend PRs that change frontend files python PRs that change python files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants