mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Check kernel dependencies when a new session is started (#16040)
* check dependencies when a new session is started * fix test * fix issue when kernel spec is not found
This commit is contained in:
@@ -476,7 +476,7 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
|
|||||||
|
|
||||||
await fs.remove(this._oldPythonInstallationPath);
|
await fs.remove(this._oldPythonInstallationPath);
|
||||||
this._upgradeInProcess = false;
|
this._upgradeInProcess = false;
|
||||||
} else {
|
} else if (!installSettings.packageUpgradeOnly) {
|
||||||
await vscode.commands.executeCommand('notebook.action.restartJupyterNotebookSessions');
|
await vscode.commands.executeCommand('notebook.action.restartJupyterNotebookSessions');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -129,6 +129,12 @@ export class JupyterSessionManager implements nb.SessionManager {
|
|||||||
// no-op
|
// no-op
|
||||||
return Promise.reject(new Error(localize('errorStartBeforeReady', "Cannot start a session, the manager is not yet initialized")));
|
return Promise.reject(new Error(localize('errorStartBeforeReady', "Cannot start a session, the manager is not yet initialized")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prompt for Python Install to check that all dependencies are installed.
|
||||||
|
// This prevents the kernel from getting stuck if a user deletes a dependency after the server has been started.
|
||||||
|
let kernelDisplayName: string = this.specs?.kernels.find(k => k.name === options.kernelName)?.display_name;
|
||||||
|
await this._installation?.promptForPythonInstall(kernelDisplayName);
|
||||||
|
|
||||||
let sessionImpl = await this._sessionManager.startNew(options);
|
let sessionImpl = await this._sessionManager.startNew(options);
|
||||||
let jupyterSession = new JupyterSession(sessionImpl, this._installation, skipSettingEnvironmentVars, this._installation?.pythonEnvVarPath);
|
let jupyterSession = new JupyterSession(sessionImpl, this._installation, skipSettingEnvironmentVars, this._installation?.pythonEnvVarPath);
|
||||||
await jupyterSession.messagesComplete;
|
await jupyterSession.messagesComplete;
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ describe('Jupyter Session Manager', function (): void {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
mockJupyterManager.setup(m => m.startNew(TypeMoq.It.isAny())).returns(() => Promise.resolve(expectedSessionInfo));
|
mockJupyterManager.setup(m => m.startNew(TypeMoq.It.isAny())).returns(() => Promise.resolve(expectedSessionInfo));
|
||||||
|
mockJupyterManager.setup(m => m.specs).returns(() => undefined);
|
||||||
|
|
||||||
// When I call startSession
|
// When I call startSession
|
||||||
let session = await sessionManager.startNew(sessionOptions, true);
|
let session = await sessionManager.startNew(sessionOptions, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user