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 starting how we start local Jupyter, remote Jupyter and raw kernels #13445

Merged
merged 14 commits into from
May 4, 2023

Conversation

DonJayamanne
Copy link
Contributor

@DonJayamanne DonJayamanne commented May 3, 2023

Part of #12832, #12831

Before (steps to start a kernel)

IJupyterNotebookProvider.connect(): connection
IJupyterNotebookProvider.createNotebook()               
   IJupyterServerProvider.getOrCreateServer()   
       IJupyterExecution.getServer()  
           ServerCache.getOrCreate(): INotebookServer
   INotebookServer.createNotebook()
       JupyterSessionManager.startNew(): Session

After (we now have clear and distinct classes with specific responsibilities)

IJupyterNotebookProvider.startJupyter(): connection
IJupyterSessionManagerFactory.create(connection): SessionManager 
JupyterSessionManager.startNew(): Session

@DonJayamanne DonJayamanne changed the title WIP Simplify starting how we start local Jupyter, remote Jupyter and raw kernels May 4, 2023
@DonJayamanne DonJayamanne marked this pull request as ready for review May 4, 2023 08:35
@DonJayamanne DonJayamanne enabled auto-merge (squash) May 4, 2023 08:35
@DonJayamanne DonJayamanne added the debt Code quality issues label May 4, 2023
const kernelConnection = options.kernelConnection;
const isLocal = isLocalConnection(kernelConnection);

if (this.rawKernelSessionCreator?.isSupported && isLocal) {
return this.rawKernelSessionCreator.create(
return this.createRawKernelSession(this.rawKernelSessionCreator, options);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: no need to pass the member rawKernelSessionCreator to a private method

NotebookCreationOptions
} from '../../types';
import { Cancellation } from '../../../platform/common/cancellation';
import { ConnectNotebookProviderOptions, IJupyterConnection } from '../../types';
import { IJupyterNotebookProvider, IJupyterServerProvider } from '../types';

// When the NotebookProvider looks to create a notebook it uses this class to create a Jupyter notebook
@injectable()
export class JupyterNotebookProvider implements IJupyterNotebookProvider {
Copy link
Contributor

@amunger amunger May 4, 2023

Choose a reason for hiding this comment

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

Could other classes just use the jupyterServerConnector or just the ServerProvider directly so that this class can be dropped? It's not providing notebooks anymore as its name suggests.

@DonJayamanne DonJayamanne merged commit b495147 into main May 4, 2023
@DonJayamanne DonJayamanne deleted the refactorRemotes branch May 4, 2023 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debt Code quality issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants