From 4ea41c852a0f15465847d993a72e02f96f239a77 Mon Sep 17 00:00:00 2001 From: Sigmar Stefansson Date: Tue, 3 Dec 2024 08:40:36 +0000 Subject: [PATCH 1/4] changes for ocean in 4.1.8 --- dev_mode/package.json | 6 +- jupyterlab/semver.py | 7 ++ jupyterlab/staging/package.json | 6 +- packages/mainmenu-extension/src/index.ts | 4 +- packages/services/src/kernel/default.ts | 2 +- packages/services/src/session/default.ts | 17 +++-- packages/services/src/session/restapi.ts | 88 ++++++++++++++++++++---- pyproject.toml | 7 +- 8 files changed, 108 insertions(+), 29 deletions(-) diff --git a/dev_mode/package.json b/dev_mode/package.json index cbd81ac3a653..bc8001c3f5dd 100644 --- a/dev_mode/package.json +++ b/dev_mode/package.json @@ -97,7 +97,7 @@ "@jupyterlab/rendermime-interfaces": "~3.11.1", "@jupyterlab/running": "~4.3.1", "@jupyterlab/running-extension": "~4.3.1", - "@jupyterlab/services": "~7.3.1", + "@jupyterlab/services": "../packages/services", "@jupyterlab/settingeditor": "~4.3.1", "@jupyterlab/settingeditor-extension": "~4.3.1", "@jupyterlab/settingregistry": "~4.3.1", @@ -116,7 +116,7 @@ "@jupyterlab/tooltip-extension": "~4.3.1", "@jupyterlab/translation": "~4.3.1", "@jupyterlab/translation-extension": "~4.3.1", - "@jupyterlab/ui-components": "~4.3.1", + "@jupyterlab/ui-components": "../packages/ui-components", "@jupyterlab/ui-components-extension": "~4.3.1", "@jupyterlab/vega5-extension": "~4.3.1", "@jupyterlab/workspaces": "~4.3.1", @@ -171,7 +171,7 @@ "@jupyterlab/launcher-extension": "~4.3.1", "@jupyterlab/logconsole-extension": "~4.3.1", "@jupyterlab/lsp-extension": "~4.3.1", - "@jupyterlab/mainmenu-extension": "~4.3.1", + "@jupyterlab/mainmenu-extension": "../packages/mainmenu-extension", "@jupyterlab/markdownviewer-extension": "~4.3.1", "@jupyterlab/markedparser-extension": "~4.3.1", "@jupyterlab/mathjax-extension": "~4.3.1", diff --git a/jupyterlab/semver.py b/jupyterlab/semver.py index b509347524a8..e133f75099d2 100644 --- a/jupyterlab/semver.py +++ b/jupyterlab/semver.py @@ -747,6 +747,13 @@ def make_range(range_, loose): class Range: def __init__(self, range_, loose): + if "/services" in range_: + range_ = "~7.3.1" + elif "/ui-components" in range_: + range_ = "~4.3.1" + elif "/mainmenu-extension" in range_: + range_ = "~4.3.1" + self.loose = loose # First, split based on boolean or || self.raw = range_ diff --git a/jupyterlab/staging/package.json b/jupyterlab/staging/package.json index 6125e4e45d19..3e2eef4479db 100644 --- a/jupyterlab/staging/package.json +++ b/jupyterlab/staging/package.json @@ -72,7 +72,7 @@ "@jupyterlab/lsp": "~4.3.1", "@jupyterlab/lsp-extension": "~4.3.1", "@jupyterlab/mainmenu": "~4.3.1", - "@jupyterlab/mainmenu-extension": "~4.3.1", + "@jupyterlab/mainmenu-extension": "../../packages/mainmenu-extension", "@jupyterlab/markdownviewer": "~4.3.1", "@jupyterlab/markdownviewer-extension": "~4.3.1", "@jupyterlab/markedparser-extension": "~4.3.1", @@ -97,7 +97,7 @@ "@jupyterlab/rendermime-interfaces": "~3.11.1", "@jupyterlab/running": "~4.3.1", "@jupyterlab/running-extension": "~4.3.1", - "@jupyterlab/services": "~7.3.1", + "@jupyterlab/services": "../../packages/services", "@jupyterlab/settingeditor": "~4.3.1", "@jupyterlab/settingeditor-extension": "~4.3.1", "@jupyterlab/settingregistry": "~4.3.1", @@ -116,7 +116,7 @@ "@jupyterlab/tooltip-extension": "~4.3.1", "@jupyterlab/translation": "~4.3.1", "@jupyterlab/translation-extension": "~4.3.1", - "@jupyterlab/ui-components": "~4.3.1", + "@jupyterlab/ui-components": "../../packages/ui-components", "@jupyterlab/ui-components-extension": "~4.3.1", "@jupyterlab/vega5-extension": "~4.3.1", "@jupyterlab/workspaces": "~4.3.1", diff --git a/packages/mainmenu-extension/src/index.ts b/packages/mainmenu-extension/src/index.ts index ec1874483413..685fb4c456e1 100644 --- a/packages/mainmenu-extension/src/index.ts +++ b/packages/mainmenu-extension/src/index.ts @@ -370,8 +370,8 @@ function createFileMenu( commands.addCommand(CommandIDs.shutdown, { label: trans.__('Shut Down'), caption: trans.__('Shut down %1', app.name), - isVisible: () => menu.quitEntry, - isEnabled: () => menu.quitEntry, + isVisible: () => false, + isEnabled: () => false, execute: () => { return showDialog({ title: trans.__('Shutdown confirmation'), diff --git a/packages/services/src/kernel/default.ts b/packages/services/src/kernel/default.ts index 925ec543ee5d..125b69a89190 100644 --- a/packages/services/src/kernel/default.ts +++ b/packages/services/src/kernel/default.ts @@ -1235,7 +1235,7 @@ export class KernelConnection implements Kernel.IKernelConnection { /** * Create the kernel websocket connection and add socket status handlers. */ - private _createSocket = (useProtocols = true) => { + private _createSocket = (useProtocols = false) => { this._errorIfDisposed(); // Make sure the socket is clear diff --git a/packages/services/src/session/default.ts b/packages/services/src/session/default.ts index 05ffeb314043..c776bbf06b36 100644 --- a/packages/services/src/session/default.ts +++ b/packages/services/src/session/default.ts @@ -209,7 +209,7 @@ export class SessionConnection implements Session.ISessionConnection { * Dispose of the resources held by the session. */ dispose(): void { - if (this.isDisposed) { + if (this._updating || this.isDisposed) { return; } this._isDisposed = true; @@ -391,10 +391,16 @@ export class SessionConnection implements Session.ISessionConnection { private async _patch( body: DeepPartial ): Promise { - const model = await updateSession( - { ...body, id: this._id }, - this.serverSettings - ); + this._updating = true; + let model: Session.IModel; + try { + model = await updateSession( + {...body, id: this._id}, + this.serverSettings + ); + } finally { + this._updating = false; + } this.update(model); return model; } @@ -422,6 +428,7 @@ export class SessionConnection implements Session.ISessionConnection { private _clientId: string; private _kernel: Kernel.IKernelConnection | null = null; private _isDisposed = false; + private _updating = false; private _disposed = new Signal(this); private _kernelChanged = new Signal< this, diff --git a/packages/services/src/session/restapi.ts b/packages/services/src/session/restapi.ts index 6198c2829620..fc9d0a168c19 100644 --- a/packages/services/src/session/restapi.ts +++ b/packages/services/src/session/restapi.ts @@ -96,6 +96,10 @@ export async function getSessionModel( return data; } +function sleep(ms: number | undefined) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + /** * Create a new session, or return an existing session if the session path * already exists. @@ -105,16 +109,45 @@ export async function startSession( settings: ServerConnection.ISettings = ServerConnection.makeSettings() ): Promise { const url = URLExt.join(settings.baseUrl, SESSION_SERVICE_URL); - const init = { + const body = JSON.stringify(options); + const bodyjson = JSON.parse(body); + bodyjson['id'] = ''; + let init = { method: 'POST', - body: JSON.stringify(options) + body: JSON.stringify(bodyjson) }; - const response = await ServerConnection.makeRequest(url, init, settings); - if (response.status !== 201) { - const err = await ServerConnection.ResponseError.create(response); - throw err; + let data = { id: '', execution_state: 'waiting' }; + let count = 0; + while (count++ < 300) { + const response = await ServerConnection.makeRequest(url, init, settings); + if (response.status !== 201) { + throw await ServerConnection.ResponseError.create(response); + } + data = await response.json(); + if (data.execution_state != 'waiting') { + console.log( + 'Kernel started in session ' + data.id + ' after ' + count + ' seconds' + ); + break; + } else { + bodyjson['id'] = data.id; + init = { + method: 'POST', + body: JSON.stringify(bodyjson) + }; + await sleep(2000); + console.log( + 'Waiting for kernel in session ' + + data.id + + ' for ' + + 2 * count + + ' seconds' + ); + } + } + if (count >= 300) { + throw new Error('10 minute timeout waiting for kernel to start'); } - const data = await response.json(); updateLegacySessionModel(data); validateModel(data); return data; @@ -128,16 +161,45 @@ export async function updateSession( settings: ServerConnection.ISettings = ServerConnection.makeSettings() ): Promise { const url = getSessionUrl(settings.baseUrl, model.id); - const init = { + const body = JSON.stringify(model); + const bodyjson = JSON.parse(body); + bodyjson['id'] = ''; + let init = { method: 'PATCH', body: JSON.stringify(model) }; - const response = await ServerConnection.makeRequest(url, init, settings); - if (response.status !== 200) { - const err = await ServerConnection.ResponseError.create(response); - throw err; + let data = { id: '', execution_state: 'waiting' }; + let count = 0; + while (count++ < 300) { + const response = await ServerConnection.makeRequest(url, init, settings); + if (response.status !== 200 && response.status !== 201) { + throw await ServerConnection.ResponseError.create(response); + } + data = await response.json(); + if (data.execution_state != 'waiting') { + console.log( + 'Kernel started in update session ' + data.id + ' after ' + count + ' seconds' + ); + break; + } else { + bodyjson['id'] = data.id; + init = { + method: 'PATCH', + body: JSON.stringify(bodyjson) + }; + await sleep(2000); + console.log( + 'Waiting for kernel in update session ' + + data.id + + ' for ' + + 2 * count + + ' seconds' + ); + } + } + if (count >= 300) { + throw new Error('10 minute timeout waiting for kernel to start'); } - const data = await response.json(); updateLegacySessionModel(data); validateModel(data); return data; diff --git a/pyproject.toml b/pyproject.toml index 969ccf094db3..346ce61eedff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ name = "jupyterlab" description = "JupyterLab computational environment" readme = "README.md" license = { file = "LICENSE" } -requires-python = ">=3.8" +requires-python = ">=3.11" authors = [ { name = "Jupyter Development Team", email = "jupyter@googlegroups.com" }, ] @@ -42,7 +42,7 @@ dependencies = [ "ipykernel>=6.5.0", "jinja2>=3.0.3", "jupyter_core", - "jupyter_server>=2.4.0,<3", + "jupyter_server@git+https://github.com/spotinst/jupyter_server.git@vanilla", "jupyter-lsp>=2.0.0", "jupyterlab_server>=2.27.1,<3", "notebook_shim>=0.2", @@ -56,6 +56,9 @@ dynamic = [ "version", ] +[tool.hatch.metadata] +allow-direct-references = true + [project.scripts] jlpm = "jupyterlab.jlpmapp:main" jupyter-lab = "jupyterlab.labapp:main" From 89ed083362475efe5204f51446fea64ac14cabc7 Mon Sep 17 00:00:00 2001 From: Sigmar Stefansson Date: Tue, 3 Dec 2024 08:53:10 +0000 Subject: [PATCH 2/4] upgrade logo --- packages/ui-components/style/icons/jupyter/jupyter.svg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/ui-components/style/icons/jupyter/jupyter.svg b/packages/ui-components/style/icons/jupyter/jupyter.svg index bc7ba182fba3..34b9e60c9a20 100644 --- a/packages/ui-components/style/icons/jupyter/jupyter.svg +++ b/packages/ui-components/style/icons/jupyter/jupyter.svg @@ -1,4 +1,4 @@ - - - + + From 660266031c1e7f19ff05b1591f282cfcd7def3ac Mon Sep 17 00:00:00 2001 From: Sigmar Stefansson Date: Tue, 3 Dec 2024 09:00:03 +0000 Subject: [PATCH 3/4] add ofas jupyter-server branch --- dev_mode/package.json | 4 ++-- packages/mainmenu-extension/src/index.ts | 4 ++-- pyproject.toml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dev_mode/package.json b/dev_mode/package.json index bc8001c3f5dd..5e26cad66d53 100644 --- a/dev_mode/package.json +++ b/dev_mode/package.json @@ -72,7 +72,7 @@ "@jupyterlab/lsp": "~4.3.1", "@jupyterlab/lsp-extension": "~4.3.1", "@jupyterlab/mainmenu": "~4.3.1", - "@jupyterlab/mainmenu-extension": "~4.3.1", + "@jupyterlab/mainmenu-extension": "../packages/mainmenu-extension", "@jupyterlab/markdownviewer": "~4.3.1", "@jupyterlab/markdownviewer-extension": "~4.3.1", "@jupyterlab/markedparser-extension": "~4.3.1", @@ -171,7 +171,7 @@ "@jupyterlab/launcher-extension": "~4.3.1", "@jupyterlab/logconsole-extension": "~4.3.1", "@jupyterlab/lsp-extension": "~4.3.1", - "@jupyterlab/mainmenu-extension": "../packages/mainmenu-extension", + "@jupyterlab/mainmenu-extension": "~4.3.1", "@jupyterlab/markdownviewer-extension": "~4.3.1", "@jupyterlab/markedparser-extension": "~4.3.1", "@jupyterlab/mathjax-extension": "~4.3.1", diff --git a/packages/mainmenu-extension/src/index.ts b/packages/mainmenu-extension/src/index.ts index 685fb4c456e1..2f6bf28adbff 100644 --- a/packages/mainmenu-extension/src/index.ts +++ b/packages/mainmenu-extension/src/index.ts @@ -439,8 +439,8 @@ function createFileMenu( commands.addCommand(CommandIDs.logout, { label: trans.__('Log Out'), caption: trans.__('Log out of %1', app.name), - isVisible: () => menu.quitEntry, - isEnabled: () => menu.quitEntry, + isVisible: () => false, + isEnabled: () => false, execute: () => { router.navigate('/logout', { hard: true }); } diff --git a/pyproject.toml b/pyproject.toml index 346ce61eedff..3cbdf8f7f008 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ dependencies = [ "ipykernel>=6.5.0", "jinja2>=3.0.3", "jupyter_core", - "jupyter_server@git+https://github.com/spotinst/jupyter_server.git@vanilla", + "jupyter_server@git+https://github.com/spotinst/jupyter_server.git@ddf0b98", "jupyter-lsp>=2.0.0", "jupyterlab_server>=2.27.1,<3", "notebook_shim>=0.2", From 74ed649562f14dbc4c3cd3965320173026529f5e Mon Sep 17 00:00:00 2001 From: Sigmar Stefansson Date: Thu, 5 Dec 2024 14:07:11 +0000 Subject: [PATCH 4/4] upgrade to 4.3.2 --- jupyterlab/semver.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jupyterlab/semver.py b/jupyterlab/semver.py index e133f75099d2..5ea9196fbeb1 100644 --- a/jupyterlab/semver.py +++ b/jupyterlab/semver.py @@ -748,11 +748,11 @@ def make_range(range_, loose): class Range: def __init__(self, range_, loose): if "/services" in range_: - range_ = "~7.3.1" + range_ = "~7.3.2" elif "/ui-components" in range_: - range_ = "~4.3.1" + range_ = "~4.3.2" elif "/mainmenu-extension" in range_: - range_ = "~4.3.1" + range_ = "~4.3.2" self.loose = loose # First, split based on boolean or ||