Add Scoped per-evaluation external properties to config evaluators#1585
Open
gootik wants to merge 1 commit into
Open
Add Scoped per-evaluation external properties to config evaluators#1585gootik wants to merge 1 commit into
gootik wants to merge 1 commit into
Conversation
Member
|
In general, I agree that this should be doable. Some concerns:
|
Author
|
@bioball that's great feedback thank you. I'll work on these items |
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.
We would like to use Pkl in our request path, by evaluating the
configuration per request based on the provided context. This usecase
allows us to have the niceties of Pkl and allow for a runtime
per-request evaluation.
For example the following would be very useful:
In RPC services, evaluator setup is stable. The request inputs are the
only things changing. As an example
Before this change, the safe option was to create a new evaluator
whenever those properties changed. However, this is not ideal for latency
sensitive environments. This flow uses more CPU and memory for
evaluation of config per request.
Reusing an evaluator was also risky because module/resource evaluation
caches can retain values derived from
read("prop:..."), so one requestcould see stale inputs from another request.
This PR adds per-evaluation external property overloads. Scoped
evaluations overlay the evaluator’s configured external properties for
one call and use isolated module/resource evaluation caches for that call.
I'm not entirely sure if this is the right approach, so opening the PR
for feedback. Also, note that this PR was achieved with help of Codex,
I'm not sure what is the policy of this repo regarding AI usage for
contributions.
Please let me know if this is not okay.