From eb465fde1a499e3fa365a27c1cf552ae4f862578 Mon Sep 17 00:00:00 2001 From: Cory Rivera Date: Mon, 14 Oct 2019 15:31:53 -0700 Subject: [PATCH] Skip prompting for package upgrade if a python install is already in progress. (#7717) --- .../src/jupyter/jupyterServerInstallation.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/extensions/notebook/src/jupyter/jupyterServerInstallation.ts b/extensions/notebook/src/jupyter/jupyterServerInstallation.ts index 873e08bca7..dc5a2dcaa3 100644 --- a/extensions/notebook/src/jupyter/jupyterServerInstallation.ts +++ b/extensions/notebook/src/jupyter/jupyterServerInstallation.ts @@ -34,6 +34,7 @@ const msgInstallPkgFinish = localize('msgInstallPkgFinish', "Notebook dependenci const msgPythonRunningError = localize('msgPythonRunningError', "Cannot overwrite an existing Python installation while python is running. Please close any active notebooks before proceeding."); const msgPendingInstallError = localize('msgPendingInstallError', "Another Python installation is currently in progress."); const msgSkipPythonInstall = localize('msgSkipPythonInstall', "Python already exists at the specific location. Skipping install."); +const msgSkippedPackageUpgrade = localize('msgSkippedPackageUpgrade', "Skipping notebook package upgrade since another Python install is currently in progress."); function msgDependenciesInstallationFailed(errorMessage: string): string { return localize('msgDependenciesInstallationFailed', "Installing Notebook dependencies failed with error: {0}", errorMessage); } function msgDownloadPython(platform: string, pythonDownloadUrl: string): string { return localize('msgDownloadPython', "Downloading local python for platform: {0} to {1}", platform, pythonDownloadUrl); } @@ -388,8 +389,18 @@ export class JupyterServerInstallation { /** * Prompts user to upgrade certain python packages if they're below the minimum expected version. */ - public promptForPackageUpgrade(): Promise { - return this.upgradePythonPackages(true, false); + public async promptForPackageUpgrade(): Promise { + if (this._installInProgress) { + this.apiWrapper.showInfoMessage(msgSkippedPackageUpgrade); + return; + } + + this._installInProgress = true; + try { + await this.upgradePythonPackages(true, false); + } finally { + this._installInProgress = false; + } } private async upgradePythonPackages(promptForUpgrade: boolean, forceInstall: boolean): Promise {