-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load kernels from cache and kernel for active interpreter #6754
Conversation
Codecov Report
@@ Coverage Diff @@
## main #6754 +/- ##
======================================
- Coverage 69% 68% -2%
======================================
Files 412 411 -1
Lines 28621 28641 +20
Branches 4272 4283 +11
======================================
- Hits 19849 19569 -280
- Misses 7079 7401 +322
+ Partials 1693 1671 -22
|
listKernels(resource: Resource, cancelToken?: CancellationToken): Promise<LocalKernelConnectionMetadata[]>; | ||
listNonPythonKernels( | ||
cancelToken?: CancellationToken, | ||
useCache?: 'useCache' | 'ignoreCache' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't want to use a boolean, i feel this is more descriptive
// Possible the kernelspec file no longer exists, in such cases, exclude this cached kernel from the list. | ||
promises.push( | ||
this.fs | ||
.localFileExists(item.kernelSpec.specFile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is true? Do we ever create 'startUsingKernelSpec' without a specfile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in I don't see this condition from before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code in the jupyterKernelService seems to rely on the fact that the specFile doesn't exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its possible the user deleted the kernelspec file.
As in I don't see this condition from before.
Thats correct, thats because we always serach and return only kernelspecs that exist on disc.
However now that I'm caching it, its possibel the user subsequently uninstalls/deletes that kernelspec from disc. In which case, the item in the cache is no longer valid (as it doesn't exist).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So yes we only search for ones on disk, but I thought we generate ones too, where the file may not have ever existed. So this would destroy those (as well as removing the ones you intend).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here the file may not have ever existed. So this would destroy those (as well as removing the ones you intend).
In that case, aren't we starting from PythonInterpreter
& not from kernel spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I.e. if we're starting from a kernel spec, then the spec file must exist & this code ensures we only deal with those kernels where kind= startUsingKernelSpec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aren't we starting from PythonInterpreter & not from kernel spec.
I can't say what the type would end up as. I mean you can test it and find out. Or maybe just look at all the spots where it's 'startUsingKernelSpec' and verify they always need a kernelspec. I thought we always create a 'default' one that may or may not have an actual kernelspec on disk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where it's 'startUsingKernelSpec' and verify they always need a kernelspec.
Yup, i checked, and can confirm that it must exist.
thought we always create a 'default' one that may or may not have an actual kernelspec on disk.
Yes, in that case the kind=DefaultKernelConnectionMetadata
Hence the code i have should work correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought we always create a 'default' one that may or may not have an actual kernelspec on disk.
Yes, thats for when we start Python interpreters (we have a bogus kernelspec, which will get created only when we register the kernel), Again, i'm not interested in those (not interested when we start using Python interpreter).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏲️
Part of #5861
First time users
Users coming back