Disable python downloads when running notebooks on a SAW. (#11186)

This commit is contained in:
Cory Rivera
2020-07-07 11:32:05 -07:00
committed by GitHub
parent 9f0584f88f
commit f409abfc01
8 changed files with 48 additions and 39 deletions

View File

@@ -127,8 +127,11 @@ export class PerFolderServerInstance implements IServerInstance {
private childProcess: ChildProcess;
private errorHandler: ErrorHandler = new ErrorHandler();
private readonly notebookScriptPath: string;
constructor(private options: IInstanceOptions, fsUtils?: ServerInstanceUtils) {
this.utils = fsUtils || new ServerInstanceUtils();
this.notebookScriptPath = path.join(this.options.install.extensionPath, 'resources', 'pythonScripts', 'startNotebook.py');
}
public get isStarted(): boolean {
@@ -162,7 +165,7 @@ export class PerFolderServerInstance implements IServerInstance {
}
if (this._isStarted) {
let install = this.options.install;
let stopCommand = `"${install.pythonExecutable}" -m jupyter notebook stop ${this._port}`;
let stopCommand = `"${install.pythonExecutable}" "${this.notebookScriptPath}" stop ${this._port}`;
await this.utils.executeBufferedCommand(stopCommand, install.execOptions, install.outputChannel);
}
} catch (error) {
@@ -243,7 +246,7 @@ export class PerFolderServerInstance implements IServerInstance {
let token = await utils.getRandomToken();
this._uri = vscode.Uri.parse(`http://localhost:${port}/?token=${token}`);
this._port = port.toString();
let startCommand = `"${this.options.install.pythonExecutable}" -m jupyter notebook --no-browser --no-mathjax --notebook-dir "${notebookDirectory}" --port=${port} --NotebookApp.token=${token}`;
let startCommand = `"${this.options.install.pythonExecutable}" "${this.notebookScriptPath}" --no-browser --no-mathjax --notebook-dir "${notebookDirectory}" --port=${port} --NotebookApp.token=${token}`;
this.notifyStarting(this.options.install, startCommand);
// Execute the command