Skip to content

Raw kernel auto start fix + #12337

Merged
IanMatthewHuff merged 6 commits into
microsoft:masterfrom
IanMatthewHuff:dev/ianhu/rawAutoStartFix
Jun 16, 2020
Merged

Raw kernel auto start fix + #12337
IanMatthewHuff merged 6 commits into
microsoft:masterfrom
IanMatthewHuff:dev/ianhu/rawAutoStartFix

Conversation

@IanMatthewHuff

Copy link
Copy Markdown
Member

For #12330

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR).
  • Title summarizes what is changing.
  • Has a news entry file (remember to thank yourself!).
  • Appropriate comments and documentation strings in the code.
  • Has sufficient logging.
  • Has telemetry for enhancements.
  • Unit tests & system/integration tests are added/updated.
  • Test plan is updated as appropriate.
  • package-lock.json has been regenerated by running npm install (if dependencies have changed).
  • The wiki is updated with any design decisions/details.

@IanMatthewHuff

Copy link
Copy Markdown
Member Author

Testing for this is covered by the ipywidget real python tests, which we know since those tests breaking exposed this issue :).

@IanMatthewHuff

Copy link
Copy Markdown
Member Author

A bit of explanation for this fix.

As of about a week ago (at the bug bash) we realized that raw kernel wasn't correctly honoring the disableJupyterAutoStart setting which should keep our UI from automatically connecting to a kernel when you open a notebook.

A fix when in for that, but it broke the nightly real jupyter widget tests. The reason for this break was that due to the change to honor disableJupyterAutoStart we now would fail to auto start in one specific case. This change is to fix that case and also a code health improvement in that area.

// When a server starts, make sure we create a notebook if the server matches
jupyterExecution.serverStarted(this.checkForNotebookProviderConnection.bind(this));
// When a notebook provider first makes its connection check it to see if we should create a notebook
this.disposables.push(notebookProvider.onConnectionMade(this.checkForNotebookProviderConnection.bind(this)));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This change here is the crux of the fix. Our autostart preload is handled in serverLoad.ts for two main cases.

  1. At activation if Interactive window or notebook editor has been used in the last 7 days
  2. At notebook editor load

After my fix to honor the disableJupyterAutoStart setting raw kernel was respecting case #1 above (which is why we were not initially seeing the issue, for all of us #1 would apply basically all of the time) but we were not honoring #2. Case two is handled by this change here.

But more changes here were for code health cleanup as well. The interactiveBase is supposed to be communicating the the notebook provider for getting a notebook and associated info. It's very crummy coupling for it to have awareness of jupyterExecution and to be referencing it. So in addition to this change I've also made changes to remove jupyterExecution fully from interactiveBase.

export class JupyterExecutionBase implements IJupyterExecution {
private usablePythonInterpreter: PythonInterpreter | undefined;
private eventEmitter: EventEmitter<void> = new EventEmitter<void>();
private startedEmitter: EventEmitter<INotebookServerOptions> = new EventEmitter<INotebookServerOptions>();

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In interactiveBase.ts you'll notice that I also removed a usage of jupyterExecution that was watching this event. Turns out this event has never (or at least when I went back a year in the code) been hooked up. It's here, but it's never having .fire() called on it. So I removed it and the associated code in a couple of different places.

This is part of LiveShare, but I checked that the live share tests passed, and as this has never been hooked up I feel ok removing it.

Comment thread src/client/datascience/raw-kernel/rawNotebookProvider.ts Outdated
Comment thread src/client/datascience/types.ts Outdated
Comment thread src/client/datascience/types.ts

@rchiodo rchiodo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

:shipit:

@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@IanMatthewHuff

Copy link
Copy Markdown
Member Author

Running a flake set to check results:
https://dev.azure.com/ms/vscode-python/_build/results?buildId=87686&view=results

@IanMatthewHuff IanMatthewHuff merged commit 7f44848 into microsoft:master Jun 16, 2020
@IanMatthewHuff IanMatthewHuff deleted the dev/ianhu/rawAutoStartFix branch June 16, 2020 14:45
@lock lock Bot locked as resolved and limited conversation to collaborators Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants