-
Notifications
You must be signed in to change notification settings - Fork 618
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(artifacts): extend cache cleanup to allow specifying a target fraction #6152
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #6152 +/- ##
==========================================
- Coverage 77.96% 77.84% -0.13%
==========================================
Files 377 377
Lines 43613 43627 +14
==========================================
- Hits 34004 33960 -44
- Misses 9557 9615 +58
Partials 52 52
Flags with carried forward coverage won't be shown. Click here to find out more.
|
8b5a1b8
to
92e679e
Compare
def cleanup( | ||
self, | ||
target_size: Optional[int] = None, | ||
target_fraction: Optional[float] = None, |
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.
This breaks existing callsites, e.g.
Line 2208 in f0caa63
reclaimed_bytes = cache.cleanup(target_size, remove_temp) |
New arguments can be safely added at the end, but not in the middle.
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.
馃う
Fixes
Description
Add an optional
target_fraction
argument toArtifactsCache.cleanup
so thatcleanup(target_fraction=0.25)
will remove at least 75% of the current bytes and leave the most recently accessed 25% (or less) used.馃 Generated by Copilot at 8b5a1b8
Improved the
cleanup
function of theArtifactsCache
class to support custom cache size limits and ratios. Modifiedwandb/sdk/artifacts/artifacts_cache.py
to implement the new functionality.Testing
This is a dependency of #6149, which adds tests for full coverage at a higher level.
Checklist
馃 Generated by Copilot at 8b5a1b8