Skip to content

Conversation

joyceerhl
Copy link
Contributor

Fix #7288

@joyceerhl joyceerhl requested a review from a team as a code owner September 8, 2021 22:23
@@ -77,7 +77,7 @@ export class KernelProvider implements IKernelProvider {
this.pendingDisposables.clear();
await Promise.all(items);
}
public getOrCreate(notebook: NotebookDocument, options: KernelOptions): IKernel | undefined {
public getOrCreate(notebook: NotebookDocument, options: KernelOptions): IKernel {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eew, can't remember why I ever returned undefined, so wrong

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix

Copy link
Contributor

@DonJayamanne DonJayamanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope sure we should be disposing the controller

@codecov-commenter
Copy link

codecov-commenter commented Sep 9, 2021

Codecov Report

Merging #7469 (1f607f0) into main (7a0c4ac) will decrease coverage by 0%.
The diff coverage is 78%.

❗ Current head 1f607f0 differs from pull request most recent head 3ae95ae. Consider uploading reports for the commit 3ae95ae to get more accurate results

@@          Coverage Diff          @@
##            main   #7469   +/-   ##
=====================================
- Coverage     64%     64%   -1%     
=====================================
  Files        361     361           
  Lines      22511   22505    -6     
  Branches    3424    3422    -2     
=====================================
- Hits       14569   14536   -33     
- Misses      6727    6745   +18     
- Partials    1215    1224    +9     
Impacted Files Coverage Δ
...science/jupyter/kernels/kernelDependencyService.ts 88% <ø> (-1%) ⬇️
src/client/datascience/jupyter/kernels/types.ts 100% <ø> (ø)
src/client/datascience/types.ts 100% <ø> (ø)
...ce/interactive-window/interactiveWindowProvider.ts 71% <50%> (-2%) ⬇️
src/client/datascience/jupyter/kernels/kernel.ts 71% <50%> (-4%) ⬇️
...atascience/interactive-window/interactiveWindow.ts 52% <80%> (+2%) ⬆️
...ient/datascience/jupyter/kernels/kernelProvider.ts 89% <100%> (+1%) ⬆️
...nt/datascience/notebook/helpers/notebookUpdater.ts 88% <0%> (-8%) ⬇️
...datascience/interactive-common/notebookProvider.ts 81% <0%> (-7%) ⬇️
... and 11 more

@joyceerhl
Copy link
Contributor Author

Ended up reverting the change I was attempting to not cache the kernel in the IW. Debugged it locally and it appears to cause execution to slow down significantly for the #%% cell codepath (input box codepath is fine).

Copy link
Contributor

@DonJayamanne DonJayamanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can we revert comparing toString of uri to comparing the object refs

… start failures don't get cached after switching controllers
(We are no longer autostarting a backup kernel, so the original reason for making the dialog non-modal is moot)
… selected for this IW, and dispose all selection change listeners in IW.dispose
const selection = this.isCodeSpace
? installPrompt
: await Promise.race([
this.appShell.showErrorMessage(message, { modal }, ...options),
this.appShell.showErrorMessage(message, { modal: true }, ...options),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making this modal for now since changing controllers while we're attempting to connect to a kernel does not cancel that connection (kernelProvider still returns the existing kernel promise)

public get readyPromise(): Promise<NotebookEditor> {
return this._editorReadyPromise;
public get readyPromise(): Promise<void> {
return Promise.all([this._editorReadyPromise, this._kernelReadyPromise]).then(noop, noop);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously the kernel promise was part of the editor ready promise, so if the kernel failed to start e.g. due to ipykernel not being installed, subsequent executions would fail while awaiting on the editor ready (if the kernel promise successfully resolved, there wasn't an issue). PR splits out the kernel promise

@joyceerhl joyceerhl merged commit c0f2a08 into main Sep 10, 2021
@joyceerhl joyceerhl deleted the dev/joyceerhl/iw-change-kernel branch September 10, 2021 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing the kernel doesn't work for Interactive
6 participants