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

Pass resource to track Kernel Metadata against a resource #4760

Merged
merged 11 commits into from
Feb 11, 2021

Conversation

DonJayamanne
Copy link
Contributor

Addresses the comments from here #4742 (comment)

@@ -147,8 +147,7 @@ export class KernelSelector implements IKernelSelectionUsage {
notebookMetadata?: nbformat.INotebookMetadata,
disableUI?: boolean,
cancelToken?: CancellationToken,
ignoreDependencyCheck?: boolean,
ignoreTrackingKernelInformation?: boolean
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 the hacks & assumptions.
Just because some of these methods were called doesn't mean the kernel was changed.
We now track the kernel against the URI where these methods are called & kernel information is actually changed/set. No assumptions.

@@ -86,9 +86,7 @@ export class InterpreterPackages {
const packageAndVersions = new Map<string, string>();
// Add defaults.
interestedPackages.forEach((item) => {
if (!packageAndVersions.has(item)) {
packageAndVersions.set(item, 'NOT INSTALLED');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should have been hashed (no harm, it was a noop)


// Select a new kernel using the connection information
const kernel = await this.kernelSelector.selectJupyterKernel(
options.identity,
options.resource,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bug fix.

@DonJayamanne DonJayamanne marked this pull request as ready for review February 11, 2021 19:50
@DonJayamanne DonJayamanne requested a review from a team as a code owner February 11, 2021 19:50
@DonJayamanne DonJayamanne changed the title Pass resource information around Pass resource information around to track selected Kernel Metadata against a resoruce Feb 11, 2021
@DonJayamanne DonJayamanne changed the title Pass resource information around to track selected Kernel Metadata against a resoruce Pass resource information around to track selected Kernel Metadata against a resource Feb 11, 2021
@codecov-io
Copy link

codecov-io commented Feb 11, 2021

Codecov Report

Merging #4760 (afc933f) into main (93d6475) will increase coverage by 0%.
The diff coverage is 81%.

@@          Coverage Diff          @@
##            main   #4760   +/-   ##
=====================================
  Coverage     76%     77%           
=====================================
  Files        411     411           
  Lines      26963   26958    -5     
  Branches    3909    3906    -3     
=====================================
+ Hits       20741   20782   +41     
+ Misses      4611    4576   -35     
+ Partials    1611    1600   -11     
Impacted Files Coverage Δ
...client/datascience/commands/activeEditorContext.ts 91% <ø> (ø)
...active-common/intellisense/intellisenseProvider.ts 75% <ø> (+<1%) ⬆️
...ent/datascience/jupyter/jupyterNotebookProvider.ts 75% <ø> (ø)
...science/jupyter/liveshare/guestJupyterExecution.ts 73% <ø> (ø)
...datascience/jupyter/liveshare/hostJupyterServer.ts 86% <ø> (ø)
...lient/datascience/jupyter/liveshare/serverCache.ts 83% <ø> (ø)
src/client/datascience/notebook/kernelProvider.ts 80% <ø> (ø)
src/client/datascience/notebook/notebookEditor.ts 45% <0%> (-2%) ⬇️
...atascience/notebookStorage/nativeEditorProvider.ts 80% <ø> (ø)
src/client/datascience/types.ts 100% <ø> (ø)
... and 38 more

@@ -183,6 +183,7 @@ export class IPyWidgetScriptSource implements ILocalResourceUriConverter {
if (!this.notebook) {
this.notebook = await this.notebookProvider.getOrCreateNotebook({
identity: this.identity,
resource: this.identity,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is resource the same as identity? Or does it not matter in this context?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't matter in this context (basically use the best we have, majority of the time identify = resoruce, except in interactive window when you open it without a correspoding py file or when you have multiples.


// If it didn't start, attempt for local and if allowed.
if (!providerConnection && !this.configService.getSettings(undefined).disableJupyterAutoStart) {
// Local case, try creating one
providerConnection = await this.notebookProvider.connect({
getOnly: false,
resource: undefined,
Copy link
Member

Choose a reason for hiding this comment

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

Does this then get updated later? Just making sure that if a server is preloaded that the undefined here was going to stay even when we start up the actual notebook later when opening the file.

Copy link
Member

Choose a reason for hiding this comment

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

ChangeKernel should trigger the update it looks like?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When we start the actual notebook, then we'd be connecting to some kernel, hence at that point with Jupyter we'd change the kernel.
And with Raw, we'd end up starting a different kernel.

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. passing undefined is ok for auto start.

@DonJayamanne DonJayamanne changed the title Pass resource information around to track selected Kernel Metadata against a resource Pass resource to track Kernel Metadata against a resource Feb 11, 2021
@DonJayamanne DonJayamanne merged commit 4a0eefa into main Feb 11, 2021
@DonJayamanne DonJayamanne deleted the fixResources branch February 11, 2021 22:05
DonJayamanne added a commit that referenced this pull request Feb 11, 2021
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.

4 participants