Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move ocean specific code to 4.1.0 #17

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev_mode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"@jupyterlab/rendermime-interfaces": "~3.9.0",
"@jupyterlab/running": "~4.1.0",
"@jupyterlab/running-extension": "~4.1.0",
"@jupyterlab/services": "~7.1.0",
"@jupyterlab/services": "../packages/services",
"@jupyterlab/settingeditor": "~4.1.0",
"@jupyterlab/settingeditor-extension": "~4.1.0",
"@jupyterlab/settingregistry": "~4.1.0",
Expand Down
3 changes: 3 additions & 0 deletions jupyterlab/semver.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,9 @@ def make_range(range_, loose):

class Range:
def __init__(self, range_, loose):
if "/services" in range_:
range_ = "~7.1.0"

self.loose = loose
# First, split based on boolean or ||
self.raw = range_
Expand Down
2 changes: 1 addition & 1 deletion jupyterlab/staging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"@jupyterlab/rendermime-interfaces": "~3.9.0",
"@jupyterlab/running": "~4.1.0",
"@jupyterlab/running-extension": "~4.1.0",
"@jupyterlab/services": "~7.1.0",
"@jupyterlab/services": "../../packages/services",
"@jupyterlab/settingeditor": "~4.1.0",
"@jupyterlab/settingeditor-extension": "~4.1.0",
"@jupyterlab/settingregistry": "~4.1.0",
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
46 changes: 39 additions & 7 deletions packages/services/src/session/restapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ 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 +108,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 Down
Loading