forked from jupyter-server/jupyter_server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trigger a websocket reconnect event when scala kernels do not connect…
… the first time. (jupyter-server#438)
- Loading branch information
Showing
7 changed files
with
120 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
data_studio_jupyter_extensions/events/kernels/kernel-scala-bandaid.v1.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
$id: event.datastudio.jupyter.com/kernel-scala-bandaid | ||
version: 1 | ||
title: Scala Bandaid | ||
description: | | ||
Addresses a bug we see in Scala Kernels. They don't always connect | ||
on the first go around. If this happens, we trigger an event | ||
that JupyterLab can listen for and re-establish a websocket connection. | ||
type: object | ||
properties: | ||
msg: | ||
title: Message type | ||
description: | | ||
Message returned by the event. | ||
required: | ||
- msg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { | ||
JupyterFrontEnd, | ||
JupyterFrontEndPlugin | ||
} from '@jupyterlab/application'; | ||
|
||
import { EventListener } from './eventlistener'; | ||
import { | ||
INotebookTracker | ||
// NotebookPanel | ||
// INotebookModel | ||
} from '@jupyterlab/notebook'; | ||
/** | ||
* A plugin to capture failure launching kernel and surface to the user. | ||
*/ | ||
export const ScalaBandaidPlugin: JupyterFrontEndPlugin<void> = { | ||
id: 'data_studio:scala_bandaid_plugin', | ||
autoStart: true, | ||
requires: [], | ||
activate: async (app: JupyterFrontEnd, notebookTracker: INotebookTracker) => { | ||
console.log('JupyterLab extension "Scala Bandaid Dialog" is activated!'); | ||
// Create a listener for kernel-failed events. | ||
const listener = EventListener.getInstance(); | ||
|
||
listener.addCallback( | ||
'event.datastudio.jupyter.com/kernel-scala-bandaid', | ||
(data: any) => { | ||
// Reconnect to the kernel | ||
app.commands.execute('reconnect-to-kernel'); | ||
} | ||
); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters