Skip to content
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

Revision to displaying cached remote kernel specs and live kernels #9985

Merged
merged 13 commits into from
May 12, 2022

Conversation

DonJayamanne
Copy link
Contributor

Part of #9167

The previous implementation was incorrect and as follows:

  • We used to cache and always display the cached remove kernel specs and remote live kernels

However the requirement is:

  • If the user attempts to connect to a remote kernel, then notify them about the errors.

To make this possible we decided to only display the kernels they had used.
The implementation of this logic was incorrect:

  • We loaded all cached remote kernelspecs & remote live kernels
  • Then when we get the latest kernelspecs & latest remove live kernels we'd remove some of them
  • & if the user attempted to use any of these outdated items, we'd notify them.

Problems

  • Therre's no need to display the cached kernelspecs, we can wait to get the latest kernel specs from the server
  • Instead of displayed all caching live remove kernels we only need to display a live kernel that was used by a notebook. If a user connects to a remote jupyter server there could already be a few live remote kernels on that machine, and we don't need to display those, as the user never used them in vscode.

Revised solution

  • Do not display cached remote kernelspecs (get latest from server)
  • Display cached live remote kernels that were used once before (later remove them if the user switches a kernel or removes these remote jupyter servers completely)

@DonJayamanne DonJayamanne changed the title Misc Revision to displaying cached remote kernel specs and live kernels May 11, 2022
@codecov-commenter
Copy link

codecov-commenter commented May 11, 2022

Codecov Report

Merging #9985 (ab90aa2) into main (38caef1) will decrease coverage by 0%.
The diff coverage is n/a.

❗ Current head ab90aa2 differs from pull request most recent head 431d956. Consider uploading reports for the commit 431d956 to get more accurate results

@@         Coverage Diff          @@
##           main   #9985   +/-   ##
====================================
- Coverage    63%     63%   -1%     
====================================
  Files       209     210    +1     
  Lines      9948    9970   +22     
  Branches   1591    1594    +3     
====================================
+ Hits       6326    6331    +5     
- Misses     3111    3121   +10     
- Partials    511     518    +7     
Impacted Files Coverage Δ
src/platform/common/utils/localize.ts 98% <ø> (ø)
src/platform/common/platform/fs-paths.ts 78% <0%> (-7%) ⬇️
src/platform/api.ts 44% <0%> (-5%) ⬇️
src/platform/errors/errorHandler.ts 62% <0%> (-3%) ⬇️
src/platform/api/kernelApi.ts 71% <0%> (-2%) ⬇️
src/platform/errors/types.ts 77% <0%> (ø)
...errors/invalidRemoteJupyterServerUriHandleError.ts 33% <0%> (ø)
...rc/platform/common/dataScienceSurveyBanner.node.ts 70% <0%> (+5%) ⬆️

@DonJayamanne DonJayamanne marked this pull request as ready for review May 11, 2022 21:07
@DonJayamanne DonJayamanne requested a review from a team as a code owner May 11, 2022 21:07
@@ -236,11 +234,6 @@ export class VSCodeNotebookController implements Disposable {
if (cells.length < 1) {
return;
}
if (this.isConnectionOutdated && !this.outdatedMessageDisplayed) {
void this.appShell.showErrorMessage(DataScience.jupyterRemoteConnectFailedModalMessage(), { modal: true });
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is no longer required, we have better ways to handle this now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I.e. we let the connection crash and handle the errors in the usual central location errorHandler.ts

@DonJayamanne DonJayamanne requested a review from rchiodo May 12, 2022 00:22
@@ -137,8 +140,6 @@ export class NotebookControllerManager implements INotebookControllerManager, IE
@inject(ICommandManager) private readonly commandManager: ICommandManager,
@inject(IExtensionContext) private readonly context: IExtensionContext,
@inject(IKernelProvider) private readonly kernelProvider: IKernelProvider,
@inject(PreferredRemoteKernelIdProvider)
private readonly preferredRemoteKernelIdProvider: PreferredRemoteKernelIdProvider,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed this as well, as this too could be handled the same way as the new code.

@@ -632,9 +600,6 @@ export class VSCodeNotebookController implements Disposable {
// Before we start the notebook, make sure the metadata is set to this new kernel.
await updateNotebookDocumentMetadata(document, this.documentManager, selectedKernelConnectionMetadata);

if (isLocalConnection(this.connection)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, love the removal of the knowledge of remote.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, one less dependency less complex

@DonJayamanne DonJayamanne merged commit 1143125 into main May 12, 2022
@DonJayamanne DonJayamanne deleted the issue9617Followup branch May 12, 2022 02:01
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.

3 participants