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

Experiment: manual jupyter server connection through uri server provider api #11945

Merged
merged 6 commits into from
Nov 8, 2022

Conversation

rebornix
Copy link
Member

@rebornix rebornix commented Nov 8, 2022

Implemented the manual jupyter server support through uri server provider api in src/standalone. Previously we had this support as a builtin concept (in other words, a special case), but now it is treated like other uri server provider (e.g. AZML). The implementation is not perfect yet but can be used to drive the improvement for

  • Jupyter server uri provider API
    • Reconnect/validation
    • Disconnect/dispose
  • Kernel picker multi step workflow

This feature is behind the same setting as experimental kernel picker, so won't affect Insider users yet.

  • 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 feature-requests.
  • 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).

@rebornix rebornix mentioned this pull request Nov 8, 2022
54 tasks
@@ -43,6 +43,9 @@ export class JupyterUriProviderWrapper implements IJupyterUriProvider {
public get displayName(): string | undefined {
return this.provider.displayName;
}
public get detail(): string | undefined {
Copy link
Member Author

Choose a reason for hiding this comment

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

id is not sufficient for the new quick pick, thus we introduced displayname and detail. We will need to revisit the updated API soon.

@@ -72,6 +72,57 @@ export type SelectJupyterUriCommandSource =
| 'errorHandler'
| 'prompt';

export async function validateSelectJupyterURI(
Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about implementing everything completely in standalone but that would be quite some effort so for now I'm still using helper functions from the core.

@@ -77,10 +74,6 @@ interface ContributedKernelFinderQuickPickItem extends QuickPickItem {
kernelFinderInfo: IContributedKernelFinder;
}

interface LocalJupyterServerQuickPickItem extends QuickPickItem {
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed this special case in the picker and moved towards serverUriProvider api.

@@ -85,4 +86,13 @@ export function registerTypes(context: IExtensionContext, serviceManager: IServi

// Dev Tools
registerDevToolTypes(context, serviceManager, isDevMode);

const configuration = serviceManager.get<IConfigurationService>(IConfigurationService);
if (configuration.getSettings().kernelPickerType === 'Insiders') {
Copy link
Member Author

Choose a reason for hiding this comment

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

We are checking this in multiple places, wish we can have a more elegant approach ;(

Copy link
Contributor

Choose a reason for hiding this comment

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

I wanted to create a single class with a single readonly property,

@codecov-commenter
Copy link

codecov-commenter commented Nov 8, 2022

Codecov Report

Merging #11945 (cef894b) into main (50f71fb) will decrease coverage by 0%.
The diff coverage is 26%.

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

@@           Coverage Diff           @@
##            main   #11945    +/-   ##
=======================================
- Coverage     62%      62%    -1%     
=======================================
  Files        492      493     +1     
  Lines      34795    34883    +88     
  Branches    5640     5646     +6     
=======================================
- Hits       21877    21655   -222     
- Misses     10845    11168   +323     
+ Partials    2073     2060    -13     
Impacted Files Coverage Δ
src/kernels/jupyter/jupyterUriProviderWrapper.ts 37% <0%> (-3%) ⬇️
src/kernels/jupyter/types.ts 100% <ø> (ø)
...llers/kernelSource/notebookKernelSourceSelector.ts 12% <0%> (+1%) ⬆️
...ndalone/userJupyterServer/userServerUrlProvider.ts 10% <10%> (ø)
src/platform/common/utils/localize.ts 75% <50%> (-1%) ⬇️
src/standalone/serviceRegistry.node.ts 95% <60%> (-5%) ⬇️
src/kernels/jupyter/serverSelector.ts 41% <80%> (-2%) ⬇️
...c/interactive-window/outputs/tracebackFormatter.ts 17% <0%> (-34%) ⬇️
src/standalone/import-export/jupyterExporter.ts 40% <0%> (-31%) ⬇️
src/notebooks/export/exportDialog.ts 35% <0%> (-24%) ⬇️
... and 49 more

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.

Lets talk about accessing data from credential store in activate event tomorrow, else everything else seems good.

@rebornix
Copy link
Member Author

rebornix commented Nov 8, 2022

@DonJayamanne comments resolved, please help take another look.

readonly detail: string = DataScience.UserJupyterServerUrlProviderDetail();
private _onDidChangeHandles = new EventEmitter<void>();
onDidChangeHandles: Event<void> = this._onDidChangeHandles.event;
private readonly _globalDisposables: IDisposable[] = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

These aren't disposed,
you'd want to pull in IDisposableRegistry into the ctor

DonJayamanne
DonJayamanne previously approved these changes Nov 8, 2022
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.

Just need to dispose the disposables, else all good

@rebornix rebornix merged commit 0fac126 into main Nov 8, 2022
@rebornix rebornix deleted the rebornix/lonely-panda branch November 8, 2022 21:36
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