-
Notifications
You must be signed in to change notification settings - Fork 353
Closed
Labels
debtCode quality issuesCode quality issues
Description
This is part of the architecture review and refactoring task #10832 and majorly focused on kernel finding/detection.
The current workflow of finding kernels (10,000 feet view) is
- Extension activation / notebook document open
- Find Kernels
- Find kernels from cache
- Find kernels from remote server
globalState - Find kernels from local kernel
globalState - Validate Kernels from cache (async)
- Find kernels from remote server
- Update
NotebookControllers - Find kernels without cache
- Find kernels from remote server, reach out to the server
- Find Kernels from local
- Searches for kernels on the file system in well known paths documented by Jupyter
- If we already search for it once, use that result (unless it's empty)
- Returns all Python kernels and any related kernels registered in the python environment
- Get interpreters from Python
- Find python global python kernel specs and non python specs
- Searches for kernels on the file system in well known paths documented by Jupyter
- Update
NotebookControllers
- Find kernels from cache
- Listen to following events
- Remote server Uri change
- Remote kernel start/dispose
- Extension change
- Conda Environment change
- Interpreters change
- When receive above events, run step 2.
As we register all the event listeners at a very top level, we accidentally trigger redundant kernel fetching requests. For example:
- When a new kernel session is created on a remote server, we will run step 2, meaning we would try to find local python kernels without cache again.
- When interpreters change, we would run step 2 again and send requests to remote server to fetch kernels/sessions
Also, when we re-run step 2, we always read cache first (which is asynchronous and not-zero-cost as it needs to validate all kernel specs) and then invalidate all caches. This makes sense on activation, but it's not necessary on event handling.
Metadata
Metadata
Assignees
Labels
debtCode quality issuesCode quality issues