Repository navigation
engine-wide dagql caching - #9682
Merged
Merged
Conversation
sipsma
force-pushed
the
cachedresults
branch
from
February 22, 2025 02:25
438d84b to
e310896
Compare
Contributor
Author
|
Split out one seperable chunk here: #9719 |
sipsma
force-pushed
the
cachedresults
branch
2 times, most recently
from
February 26, 2025 22:47
e24dde5 to
de126e2
Compare
Contributor
Author
|
Note to self: be sure to update secret transferring to not cross session-boundaries (or equivalent fix) |
Contributor
Author
|
Another chunk split out #9774 while I work through some more tests here |
sipsma
force-pushed
the
cachedresults
branch
9 times, most recently
from
March 19, 2025 19:04
e877072 to
34cb34e
Compare
sipsma
marked this pull request as ready for review
March 20, 2025 03:45
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
This was referenced May 7, 2025
4 tasks done
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.
This is the first major upgrade to dagql caching, adding a shared engine-wide cache. This is a pre-req for everything else we want to do (persistent dagql caching, default function caching, remote caching, etc.). It forces a bunch of problems to be addressed w/out being too overwhelming in scope.
The biggest problems that needed addressing were around secrets and private git repos, which need to work in the case of "cross-session cache hits" while not leaking e.g. private git repos from an authorized client to a client that does not have auth for them.
Overall, this is a mix of some good long-term fixes and some one-off mole-whacking. Quite a bit of the remaining ugliness will be addressed in the next part of this effort that adds support for persistence, cache result dependency tracking and support for multiple cache keys per-result (which are all intertwined).
Cache Changes
dagql.SessionCache, which consumes the base engine-wide cacheSessionCachekeeps track of every cache result returned in the session and releases all of them when the session is removed (i.e. main client disconnects). Cache results are ref-counted, so this means that they stay in the engine-wide cache until no sessions have open refs for them.SessionCachealso helps w/ telemetry a bit (mentioned more below)ModuleSource.Telemetry Changes
CACHEDin telemetry; previously only buildkit cache hits were displayedSessionCache(mentioned above) will only send telemetry for a given call digest once, rather than sendingCACHEDover and over every time it appears in any DAG in a sessionSecret Changes
loadSecretFromNameis rm'dsecretandsetSecret, so good to clean upsetSecrethidesplaintextin the returned ID by changing the returned ID to show it as***, rather than relying onloadSecretFromName. The real plaintext is stored in theSecretobject and loadable by ID thanks to the returned ID having a custom digest.setSecretFilejust uses thefile://secret URL now rather thansetSecretResourceTransferPostCallworks a bit differently nowplaintextforsetSecret-created secrets and thus ensure those stay available in-memory for as long as the returned object is needed. This avoids problems w/ the secret disappearing when clients disconnect and cache refs get released.Git API
gitdnssource to always check auth in the buildkitCacheKeymethodgitAPI did not automatically set username togit@for SSH urls that lacked a username (unlike git module source refs, which do have this behavior). This wasn't caught before because of the point above.gitnow if an SSH URL is provided but no SSH auth sock was provided or found from the client. This previously at best errored out much later w/ an incomprehensible buildkit error (socket "default" not found) and at worst never errored due to getting a cache hit from a different client.experimentalServiceBindingsweren't called before trying to resolve a commit, which is needed in some casesgitis nowCachePerClientgitrather than provided as args. If we didn't cache per client you could easily just specify a private repo URL you have no auth for and get a cache hittreeAPI now sets a content-hashed ID on the Directory it returnscommit(plus URL if the.gitdir is retained, since that has git remote metadata)Pre-existing problems uncovered but not fixed here
Status
After battling lots of puzzles around secrets and then numerous flakes caused by subtle issues, this is in a good state and has not flaked out in CI for 5+ runs.
TODOs:
CACHEDthat didn't used to be)TestGolden, otherwise it seemed to be extremely nondeterministic whether we'd get cache hits (due to the fact that it depends on what other sessions are running at the same time).LoadSecretFromNameor to leave it in for back-compatsetSecretFileas deprecated