Skip to content

Commit

Permalink
changes for ocean in 4.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmarkarl committed Dec 3, 2024
1 parent 31a2559 commit 4ea41c8
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 29 deletions.
6 changes: 3 additions & 3 deletions dev_mode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions jupyterlab/semver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_
Expand Down
6 changes: 3 additions & 3 deletions jupyterlab/staging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/mainmenu-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
2 changes: 1 addition & 1 deletion packages/services/src/kernel/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 12 additions & 5 deletions packages/services/src/session/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -391,10 +391,16 @@ export class SessionConnection implements Session.ISessionConnection {
private async _patch(
body: DeepPartial<Session.IModel>
): Promise<Session.IModel> {
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;
}
Expand Down Expand Up @@ -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, void>(this);
private _kernelChanged = new Signal<
this,
Expand Down
88 changes: 75 additions & 13 deletions packages/services/src/session/restapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -105,16 +109,45 @@ export async function startSession(
settings: ServerConnection.ISettings = ServerConnection.makeSettings()
): Promise<Session.IModel> {
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;
Expand All @@ -128,16 +161,45 @@ export async function updateSession(
settings: ServerConnection.ISettings = ServerConnection.makeSettings()
): Promise<Session.IModel> {
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;
Expand Down
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
]
Expand Down Expand Up @@ -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",
Expand All @@ -56,6 +56,9 @@ dynamic = [
"version",
]

[tool.hatch.metadata]
allow-direct-references = true

[project.scripts]
jlpm = "jupyterlab.jlpmapp:main"
jupyter-lab = "jupyterlab.labapp:main"
Expand Down

0 comments on commit 4ea41c8

Please sign in to comment.