mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Notebooks: Use new Python installation after configuration change (#14765)
* start new jupyter server * restart session working (removed extra code) * only restart server once * shutdown session first then stop server * add comments remove extra lines * add comment * fix test * only restart jupyter sessions * Dispose jupytersessionmanager and create new one * move restart server logic out of notebookmodel * move methods to azdata proposed * pr comment
This commit is contained in:
@@ -15,8 +15,7 @@ export class JupyterNotebookManager implements nb.NotebookManager, vscode.Dispos
|
||||
private _sessionManager: JupyterSessionManager;
|
||||
|
||||
constructor(private _serverManager: LocalJupyterServerManager, sessionManager?: JupyterSessionManager) {
|
||||
let pythonEnvVarPath = this._serverManager && this._serverManager.jupyterServerInstallation && this._serverManager.jupyterServerInstallation.pythonEnvVarPath;
|
||||
this._sessionManager = sessionManager || new JupyterSessionManager(pythonEnvVarPath);
|
||||
this._sessionManager = sessionManager || new JupyterSessionManager();
|
||||
this._serverManager.onServerStarted(() => {
|
||||
this.setServerSettings(this._serverManager.serverSettings);
|
||||
this._sessionManager.installation = this._serverManager.instanceOptions.install;
|
||||
|
||||
@@ -438,6 +438,7 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
|
||||
|
||||
this._installCompletion.resolve();
|
||||
this._installInProgress = false;
|
||||
await vscode.commands.executeCommand('notebook.action.restartJupyterNotebookSessions');
|
||||
})
|
||||
.catch(err => {
|
||||
let errorMsg = msgDependenciesInstallationFailed(utils.getErrorMessage(err));
|
||||
|
||||
@@ -65,7 +65,7 @@ export class JupyterSessionManager implements nb.SessionManager {
|
||||
private static _sessions: JupyterSession[] = [];
|
||||
private _installation: JupyterServerInstallation;
|
||||
|
||||
constructor(private _pythonEnvVarPath?: string) {
|
||||
constructor() {
|
||||
this._isReady = false;
|
||||
this._ready = new Deferred<void>();
|
||||
}
|
||||
@@ -130,7 +130,7 @@ export class JupyterSessionManager implements nb.SessionManager {
|
||||
return Promise.reject(new Error(localize('errorStartBeforeReady', "Cannot start a session, the manager is not yet initialized")));
|
||||
}
|
||||
let sessionImpl = await this._sessionManager.startNew(options);
|
||||
let jupyterSession = new JupyterSession(sessionImpl, this._installation, skipSettingEnvironmentVars, this._pythonEnvVarPath);
|
||||
let jupyterSession = new JupyterSession(sessionImpl, this._installation, skipSettingEnvironmentVars, this._installation?.pythonEnvVarPath);
|
||||
await jupyterSession.messagesComplete;
|
||||
let index = JupyterSessionManager._sessions.findIndex(session => session.path === options.path);
|
||||
if (index > -1) {
|
||||
|
||||
Reference in New Issue
Block a user