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

Simplify args used to start/connect to jupyter #9888

Merged
merged 4 commits into from
May 4, 2022

Conversation

DonJayamanne
Copy link
Contributor

Part of #8933

@@ -234,12 +234,12 @@ export class JupyterExecutionBase implements IJupyterExecution {
if (options.localJupyter) {
// If that works, then attempt to start the server
traceInfo(`Launching server`);
const useDefaultConfig = !options || options.skipUsingDefaultConfig ? false : true;
Copy link
Contributor Author

@DonJayamanne DonJayamanne May 4, 2022

Choose a reason for hiding this comment

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

This value in the options property was totally useless, as we can see the next line we access the settings.
hence why not access the settings to determine whther we're to skip using default config here itself instead of passing a property around.

This simplifies the type a lot

// Expand the working directory. Create a dummy launching file in the root path (so we expand correctly)
const workingDirectory = expandWorkingDir(
options.workingDir,
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 value in the options property was totally useless, as we can see the next line we access the workspace object.
hence why not compute the workspace directory here instead of passing properties around.

This simplifies the type a lot, fewer properties.

This simplifies the type a lot

@@ -24,8 +24,7 @@ export class JupyterNotebookProvider implements IJupyterNotebookProvider {
) {}

public async connect(options: ConnectNotebookProviderOptions): Promise<IJupyterConnection> {
const server = await this.serverProvider.getOrCreateServer(options);
const connection = await server.connection;
const { connection } = await this.serverProvider.getOrCreateServer(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.

Unnecessar await

@@ -81,8 +79,6 @@ export type INotebookServerOptions =
| {
uri: string;
resource: Resource;
skipUsingDefaultConfig?: boolean;
workingDir?: string;
ui: IDisplayOptions;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now the options to start a notebook server is much smaller.

@DonJayamanne DonJayamanne marked this pull request as ready for review May 4, 2022 00:09
@DonJayamanne DonJayamanne requested a review from a team as a code owner May 4, 2022 00:09
): Promise<IJupyterConnection | undefined> {
return this.notebookStarter?.start(
): Promise<IJupyterConnection> {
if (!this.notebookStarter) {
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 isn't possible in desktop. hence throw an error.

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 need to be localized, its basically a bug in the code that would cause the entire extensoin to go kaboom.
Wish there was a better way to handle such types, these nullables really do complicate the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hopefully this will get fixed with the refactoring I'm working on.

@codecov-commenter
Copy link

codecov-commenter commented May 4, 2022

Codecov Report

Merging #9888 (40d93f6) into main (6faaa4a) will increase coverage by 0%.
The diff coverage is n/a.

@@         Coverage Diff          @@
##           main   #9888   +/-   ##
====================================
  Coverage    63%     63%           
====================================
  Files       203     203           
  Lines      9825    9825           
  Branches   1564    1564           
====================================
+ Hits       6239    6245    +6     
+ Misses     3086    3078    -8     
- Partials    500     502    +2     
Impacted Files Coverage Δ
...rc/platform/common/dataScienceSurveyBanner.node.ts 70% <0%> (+5%) ⬆️

@DonJayamanne DonJayamanne merged commit 140d95a into main May 4, 2022
@DonJayamanne DonJayamanne deleted the simplifyArgsToStartConnectJupyter branch May 4, 2022 03:34
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