mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Add more error handling for python installation (#22650)
This commit is contained in:
@@ -430,51 +430,56 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
|
|||||||
|
|
||||||
this._installInProgress = true;
|
this._installInProgress = true;
|
||||||
this._installCompletion = new Deferred<void>();
|
this._installCompletion = new Deferred<void>();
|
||||||
|
try {
|
||||||
|
this._pythonInstallationPath = installSettings.installPath;
|
||||||
|
this._usingExistingPython = installSettings.existingPython;
|
||||||
|
await this.configurePackagePaths();
|
||||||
|
|
||||||
this._pythonInstallationPath = installSettings.installPath;
|
azdata.tasks.startBackgroundOperation({
|
||||||
this._usingExistingPython = installSettings.existingPython;
|
displayName: msgTaskName,
|
||||||
await this.configurePackagePaths();
|
description: msgTaskName,
|
||||||
|
isCancelable: false,
|
||||||
|
operation: op => {
|
||||||
|
this.installDependencies(op, forceInstall, installSettings.packages)
|
||||||
|
.then(async () => {
|
||||||
|
let notebookConfig = vscode.workspace.getConfiguration(constants.notebookConfigKey);
|
||||||
|
await notebookConfig.update(constants.pythonPathConfigKey, this._pythonInstallationPath, vscode.ConfigurationTarget.Global);
|
||||||
|
await notebookConfig.update(constants.existingPythonConfigKey, this._usingExistingPython, vscode.ConfigurationTarget.Global);
|
||||||
|
await this.configurePackagePaths();
|
||||||
|
|
||||||
azdata.tasks.startBackgroundOperation({
|
this._installCompletion.resolve();
|
||||||
displayName: msgTaskName,
|
this._installInProgress = false;
|
||||||
description: msgTaskName,
|
if (this._upgradeInProcess) {
|
||||||
isCancelable: false,
|
// Pass in false for restartJupyterServer parameter since the jupyter server has already been shutdown
|
||||||
operation: op => {
|
// when removing the old Python version on Windows.
|
||||||
this.installDependencies(op, forceInstall, installSettings.packages)
|
if (process.platform === constants.winPlatform) {
|
||||||
.then(async () => {
|
await vscode.commands.executeCommand('notebook.action.restartJupyterNotebookSessions', false);
|
||||||
let notebookConfig = vscode.workspace.getConfiguration(constants.notebookConfigKey);
|
} else {
|
||||||
await notebookConfig.update(constants.pythonPathConfigKey, this._pythonInstallationPath, vscode.ConfigurationTarget.Global);
|
await vscode.commands.executeCommand('notebook.action.restartJupyterNotebookSessions');
|
||||||
await notebookConfig.update(constants.existingPythonConfigKey, this._usingExistingPython, vscode.ConfigurationTarget.Global);
|
}
|
||||||
await this.configurePackagePaths();
|
if (this._oldUserInstalledPipPackages.length !== 0) {
|
||||||
|
await this.createInstallPipPackagesHelpNotebook(this._oldUserInstalledPipPackages);
|
||||||
|
}
|
||||||
|
|
||||||
this._installCompletion.resolve();
|
await fs.remove(this._oldPythonInstallationPath);
|
||||||
this._installInProgress = false;
|
this._upgradeInProcess = false;
|
||||||
if (this._upgradeInProcess) {
|
} else if (!installSettings.packageUpgradeOnly) {
|
||||||
// Pass in false for restartJupyterServer parameter since the jupyter server has already been shutdown
|
|
||||||
// when removing the old Python version on Windows.
|
|
||||||
if (process.platform === constants.winPlatform) {
|
|
||||||
await vscode.commands.executeCommand('notebook.action.restartJupyterNotebookSessions', false);
|
|
||||||
} else {
|
|
||||||
await vscode.commands.executeCommand('notebook.action.restartJupyterNotebookSessions');
|
await vscode.commands.executeCommand('notebook.action.restartJupyterNotebookSessions');
|
||||||
}
|
}
|
||||||
if (this._oldUserInstalledPipPackages.length !== 0) {
|
})
|
||||||
await this.createInstallPipPackagesHelpNotebook(this._oldUserInstalledPipPackages);
|
.catch(err => {
|
||||||
}
|
let errorMsg = msgDependenciesInstallationFailed(utils.getErrorMessage(err));
|
||||||
|
op.updateStatus(azdata.TaskStatus.Failed, errorMsg);
|
||||||
await fs.remove(this._oldPythonInstallationPath);
|
this._installCompletion.reject(new Error(errorMsg));
|
||||||
this._upgradeInProcess = false;
|
this._installInProgress = false;
|
||||||
} else if (!installSettings.packageUpgradeOnly) {
|
});
|
||||||
await vscode.commands.executeCommand('notebook.action.restartJupyterNotebookSessions');
|
}
|
||||||
}
|
});
|
||||||
})
|
} catch (err) {
|
||||||
.catch(err => {
|
let errorMsg = msgDependenciesInstallationFailed(utils.getErrorMessage(err));
|
||||||
let errorMsg = msgDependenciesInstallationFailed(utils.getErrorMessage(err));
|
this._installCompletion.reject(new Error(errorMsg));
|
||||||
op.updateStatus(azdata.TaskStatus.Failed, errorMsg);
|
this._installInProgress = false;
|
||||||
this._installCompletion.reject(errorMsg);
|
}
|
||||||
this._installInProgress = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return this._installCompletion.promise;
|
return this._installCompletion.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user