python: better cache in PET resolveEnv()#13168
Open
austin3dickey wants to merge 2 commits intomainfrom
Open
Conversation
|
E2E Tests 🚀 |
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.
Addresses part of #12500. Related to #12327, where some Python interpreters weren't getting resolved correctly after we bumped PET. Possibly will help with #12253 too, where some Python interpreters weren't being discovered in the first pass of discovery after we bumped PET.
resolveEnv()was decorated with@cache(30_000, true). But if PET hadn't discovered the env yet,undefinedis pinned in the cache for 30 seconds, even after PET finished discovery. Any caller in that window got the staleundefinedback. This PR replaces the decorator with an explicit cache onNativePythonEnvironmentsthat:PythonEnvInforesolutions.undefinedor thrown errors.addEnv/removeEnv, so a late-arriving PET discovery automatically supersedes any prior cached state.Release Notes
New Features
Bug Fixes
QA Notes
@:interpreter
Reusing the #13064 QA trick to simulate a slow PET: add
inside
finder.refresh's loop innativeAPI.ts.Before this PR: picking an interpreter via the picker in the first 30s after a cold start would sometimes log
Tried to switch to a language runtime that has not been registeredand fail to start.After this PR: selection should succeed as soon as PET has seen that env without a 30s penalty.
Unit tests covering the regression are included.