Repository navigation
fix caching of fields that return lists - #10410
Merged
Merged
Conversation
IDs with an nth element selected were overwriting the "leaf" selection rather than appending a new selection of the nth element. This meant that when we loaded elements from a list in an ID the ID digest was different for every element of the list with no stable digest for the list as a whole. So I *think* the end result was that we'd repeatedly call the field that returns the list *for every element in the list*. This is obviously not ideal for performance, though it would have only impacted dagql caching so far. The fix here changes IDs to append a new selection for the nth element on top of the original selection that returns the list. It then handles this carefully in ID loading such that the list is first loaded once with a stable id digest (and thus only called once thanks to dagql caching), after which elements are selected from it. Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
sipsma
force-pushed
the
adjust-enum-loading
branch
from
May 15, 2025 05:45
a6d4eb7 to
64e1e43
Compare
Signed-off-by: Erik Sipsma <[email protected]>
sipsma
force-pushed
the
adjust-enum-loading
branch
from
May 15, 2025 20:21
71d03ef to
8a561ea
Compare
jedevc
approved these changes
May 16, 2025
3 of 34 tasks
This was referenced Jul 3, 2025
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.
Spinning out a fix made while working on the dagql persistent cache. Main motivation is that I'm getting an aneurysm trying to think about the correctness of this fix in combination w/ all the other changes I'm making there, so splitting out here will help verify it independently with fewer health risks.
If correct, this is likely a performance improvement in the immediate term anyways since it would mean previously we were re-calling fields that returned lists for each element in them when loading IDs. And for the persistent dagql cache work this is strictly necessary for basic correctness.
IDs with an nth element selected were overwriting the "leaf" selection rather than appending a new selection of the nth element.
This meant that when we loaded elements from a list in an ID the ID digest was different for every element of the list with no stable digest for the list as a whole.
So the end result was that we'd repeatedly call the field that returns the list for every element in the list. This is obviously not ideal for performance, though it would have only impacted dagql caching so far.
The fix here changes IDs to append a new selection for the nth element on top of the original selection that returns the list. It then handles this carefully in ID loading such that the list is first loaded once with a stable id digest (and thus only called once thanks to dagql caching), after which elements are selected from it.
TODO: