feat: add persistent disk cache for image existence checks#790
Open
feat: add persistent disk cache for image existence checks#790
Conversation
Adds PersistentCacheImageChecker that caches verified image URIs to ~/.flyte/cache/images/. After the first successful remote manifest check (~4s), subsequent runs read from disk cache (~0ms), eliminating repeated network round-trips to the container registry. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Kevin Su <pingsutw@apache.org>
pingsutw
commented
Mar 13, 2026
| logger.debug(f"Image {image_uri} in registry") | ||
| return image_uri | ||
| # Persist to disk so future process invocations skip network checks | ||
| if checker is not PersistentCacheImageChecker: |
Member
Author
There was a problem hiding this comment.
One of the problem is the persistent cache never invalidates. If an image is deleted from the registry, the cache will still say it exists, and the build will be skipped
Member
Author
There was a problem hiding this comment.
but it makes UX way more better
Contributor
|
@pingsutw this is great, i was thinking of adding this and even code bundle hash to the local cache. Shall we just use the sqlite table to store this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PersistentCacheImageCheckerthat caches verified image URIs to~/.flyte/cache/images/on diskdocker manifest inspect), all subsequent runs hit the local disk cache (~0ms)DockerImageBuilderchecker chain, before the network-based checkersKnown limitation
~/.flyte/cache/images/or useforce=Trueto trigger a rebuild. A TTL or cache-busting strategy could be added as a follow-up.Test plan
test_cached— verifies persistent cache is checked first and other checkers are skippedtest_persistent_cache_write_and_read— verifies write/read round-trip and arch isolationLOG_LEVEL=10 python examples/basics/hello.py— first run writes cache, second run shows "found in persistent cache" in ~0ms