mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 17:23:02 -05:00
Notebooks: Use new Python installation after configuration change (#14765)
* start new jupyter server * restart session working (removed extra code) * only restart server once * shutdown session first then stop server * add comments remove extra lines * add comment * fix test * only restart jupyter sessions * Dispose jupytersessionmanager and create new one * move restart server logic out of notebookmodel * move methods to azdata proposed * pr comment
This commit is contained in:
@@ -361,6 +361,11 @@ export interface INotebookModel {
|
||||
*/
|
||||
getMetaValue(key: string): any;
|
||||
|
||||
/**
|
||||
* Restart current active session if it exists
|
||||
*/
|
||||
restartSession(): Promise<void>;
|
||||
|
||||
/**
|
||||
* Change the current kernel from the Kernel dropdown
|
||||
* @param displayName kernel name (as displayed in Kernel dropdown)
|
||||
@@ -387,7 +392,6 @@ export interface INotebookModel {
|
||||
*/
|
||||
moveCell(cellModel: ICellModel, direction: MoveDirection): void;
|
||||
|
||||
|
||||
/**
|
||||
* Deletes a cell
|
||||
*/
|
||||
@@ -403,7 +407,6 @@ export interface INotebookModel {
|
||||
*/
|
||||
onCellChange(cell: ICellModel, change: NotebookChangeType): void;
|
||||
|
||||
|
||||
/**
|
||||
* Push edit operations, basically editing the model. This is the preferred way of
|
||||
* editing the model. Long-term, this will ensure edit operations can be added to the undo stack
|
||||
|
||||
@@ -741,6 +741,14 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
}
|
||||
}
|
||||
|
||||
public async restartSession(): Promise<void> {
|
||||
if (this._activeClientSession) {
|
||||
// Old active client sessions have already been shutdown by RESTART_JUPYTER_NOTEBOOK_SESSIONS command
|
||||
this._activeClientSession = undefined;
|
||||
await this.startSession(this.notebookManager, this._selectedKernelDisplayName, true);
|
||||
}
|
||||
}
|
||||
|
||||
// When changing kernel, update the active session
|
||||
private updateActiveClientSession(clientSession: IClientSession) {
|
||||
this._activeClientSession = clientSession;
|
||||
@@ -1114,7 +1122,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
}
|
||||
}
|
||||
|
||||
private async shutdownActiveSession() {
|
||||
private async shutdownActiveSession(): Promise<void> {
|
||||
if (this._activeClientSession) {
|
||||
try {
|
||||
await this._activeClientSession.ready;
|
||||
|
||||
@@ -133,6 +133,16 @@ export class SqlSessionManager implements nb.SessionManager {
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
shutdownAll(): Thenable<void> {
|
||||
return Promise.all(SqlSessionManager._sessions.map(session => {
|
||||
return this.shutdown(session.id);
|
||||
})).then();
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
// no-op
|
||||
}
|
||||
}
|
||||
|
||||
export class SqlSession implements nb.ISession {
|
||||
|
||||
Reference in New Issue
Block a user