only restart server if there is an active session (#14885)

This commit is contained in:
Lucy Zhang
2021-03-26 15:04:08 -07:00
committed by GitHub
parent 39a47b0053
commit bbee4a1f38

View File

@@ -182,7 +182,7 @@ CommandsRegistry.registerCommand({
for (let editor of editors) { for (let editor of editors) {
if (editor instanceof NotebookInput) { if (editor instanceof NotebookInput) {
let model: INotebookModel = editor.notebookModel; let model: INotebookModel = editor.notebookModel;
if (model.providerId === 'jupyter') { if (model.providerId === 'jupyter' && model.clientSession.isReady) {
// Jupyter server needs to be restarted so that the correct Python installation is used // Jupyter server needs to be restarted so that the correct Python installation is used
if (!jupyterServerRestarted) { if (!jupyterServerRestarted) {
let jupyterNotebookManager: INotebookManager = model.notebookManagers.find(x => x.providerId === 'jupyter'); let jupyterNotebookManager: INotebookManager = model.notebookManagers.find(x => x.providerId === 'jupyter');