@datalayer/core 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/api/DatalayerApi.d.ts +38 -26
- package/lib/api/DatalayerApi.js +35 -8
- package/lib/api/iam/authentication.d.ts +8 -7
- package/lib/api/iam/authentication.js +14 -15
- package/lib/api/iam/healthz.d.ts +3 -2
- package/lib/api/iam/healthz.js +5 -3
- package/lib/api/iam/index.d.ts +9 -4
- package/lib/api/iam/index.js +9 -4
- package/lib/api/iam/oauth2.d.ts +115 -0
- package/lib/api/iam/oauth2.js +309 -0
- package/lib/api/iam/profile.d.ts +8 -1
- package/lib/api/iam/profile.js +17 -2
- package/lib/api/iam/usage.d.ts +56 -0
- package/lib/api/iam/usage.js +39 -0
- package/lib/api/index.d.ts +6 -5
- package/lib/api/index.js +6 -5
- package/lib/api/runtimes/environments.js +3 -2
- package/lib/api/runtimes/healthz.d.ts +3 -13
- package/lib/api/runtimes/healthz.js +4 -3
- package/lib/api/runtimes/index.d.ts +3 -2
- package/lib/api/runtimes/index.js +3 -2
- package/lib/api/runtimes/runtimes.js +17 -6
- package/lib/api/runtimes/snapshots.js +3 -2
- package/lib/api/spacer/documents.d.ts +12 -0
- package/lib/api/spacer/documents.js +43 -0
- package/lib/api/spacer/healthz.d.ts +3 -13
- package/lib/api/spacer/healthz.js +4 -3
- package/lib/api/spacer/index.d.ts +4 -2
- package/lib/api/spacer/index.js +4 -2
- package/lib/api/spacer/items.d.ts +9 -1
- package/lib/api/spacer/items.js +17 -2
- package/lib/api/spacer/lexicals.js +3 -2
- package/lib/api/spacer/notebooks.js +3 -2
- package/lib/api/spacer/spaces.js +3 -2
- package/lib/api/spacer/users.js +3 -2
- package/lib/api/types/common.d.ts +64 -0
- package/lib/api/types/iam.d.ts +88 -65
- package/lib/api/types/index.d.ts +4 -2
- package/lib/api/types/index.js +4 -2
- package/lib/api/types/runtimes.d.ts +9 -39
- package/lib/api/types/spacer.d.ts +37 -65
- package/lib/api/utils/validation.d.ts +24 -1
- package/lib/api/utils/validation.js +62 -1
- package/lib/client/base.d.ts +75 -0
- package/lib/client/base.js +199 -0
- package/lib/client/constants.d.ts +22 -0
- package/lib/client/constants.js +22 -0
- package/lib/client/index.d.ts +108 -0
- package/lib/client/index.js +79 -0
- package/lib/client/mixins/IAMMixin.d.ts +54 -0
- package/lib/client/mixins/IAMMixin.js +181 -0
- package/lib/client/mixins/RuntimesMixin.d.ts +93 -0
- package/lib/client/mixins/RuntimesMixin.js +229 -0
- package/lib/client/mixins/SpacerMixin.d.ts +111 -0
- package/lib/client/mixins/SpacerMixin.js +340 -0
- package/lib/client/models/Credits.d.ts +91 -0
- package/lib/client/models/Credits.js +130 -0
- package/lib/client/models/Environment.d.ts +73 -0
- package/lib/client/models/Environment.js +88 -0
- package/lib/client/models/HealthCheck.d.ts +72 -0
- package/lib/client/models/HealthCheck.js +107 -0
- package/lib/client/models/Item.d.ts +69 -0
- package/lib/client/models/Item.js +191 -0
- package/lib/client/models/Lexical.d.ts +83 -0
- package/lib/client/models/Lexical.js +152 -0
- package/lib/client/models/Notebook.d.ts +87 -0
- package/lib/client/models/Notebook.js +153 -0
- package/lib/client/models/Runtime.d.ts +122 -0
- package/lib/client/models/Runtime.js +204 -0
- package/lib/client/models/Snapshot.d.ts +92 -0
- package/lib/client/models/Snapshot.js +139 -0
- package/lib/client/models/Space.d.ts +135 -0
- package/lib/client/models/Space.js +234 -0
- package/lib/client/models/User.d.ts +64 -0
- package/lib/client/models/User.js +83 -0
- package/lib/client/models/index.d.ts +26 -0
- package/lib/client/models/index.js +25 -0
- package/lib/client/utils/mixins.d.ts +12 -0
- package/lib/{sdk/client → client}/utils/mixins.js +0 -28
- package/lib/client/utils/spacerUtils.d.ts +18 -0
- package/lib/client/utils/spacerUtils.js +32 -0
- package/lib/collaboration/DatalayerCollaboration.d.ts +6 -1
- package/lib/collaboration/DatalayerCollaboration.js +2 -2
- package/lib/collaboration/DatalayerCollaborationProvider.d.ts +5 -0
- package/lib/collaboration/DatalayerCollaborationProvider.js +10 -9
- package/lib/components/progress/CreditsIndicator.d.ts +1 -1
- package/lib/components/runtimes/RuntimeCellVariablesDialog.js +1 -1
- package/lib/components/runtimes/RuntimeLauncherDialog.d.ts +1 -1
- package/lib/components/runtimes/RuntimePickerBase.d.ts +1 -1
- package/lib/components/runtimes/RuntimePickerBase.js +1 -1
- package/lib/components/runtimes/RuntimePickerCell.js +2 -2
- package/lib/components/runtimes/RuntimePickerNotebook.d.ts +1 -1
- package/lib/components/runtimes/RuntimePickerNotebook.js +1 -1
- package/lib/components/runtimes/RuntimeTransfer.d.ts +1 -1
- package/lib/components/runtimes/RuntimeUtils.d.ts +1 -1
- package/lib/components/snapshots/RuntimeSnapshotMenu.d.ts +1 -1
- package/lib/components/snapshots/RuntimeSnapshotMenu.js +27 -20
- package/lib/config/Configuration.d.ts +8 -0
- package/lib/hooks/useDatalayer.js +1 -1
- package/lib/hooks/useRuntimes.js +1 -1
- package/lib/hooks/useToast.js +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +4 -2
- package/lib/sdk/index.d.ts +5 -4
- package/lib/sdk/index.js +6 -5
- package/lib/services/DatalayerServiceManager.js +1 -1
- package/lib/state/substates/CoreState.js +2 -0
- package/lib/state/substates/RuntimesState.d.ts +1 -1
- package/lib/state/substates/RuntimesState.js +1 -1
- package/lib/{sdk/stateful → stateful}/index.d.ts +1 -1
- package/lib/{sdk/stateful → stateful}/index.js +1 -1
- package/lib/{sdk/stateful → stateful}/jupyter/exec/Snippets.d.ts +1 -41
- package/lib/{sdk/stateful → stateful}/jupyter/exec/Snippets.js +1 -20
- package/lib/{sdk/stateful → stateful}/runtimes/actions.d.ts +3 -3
- package/lib/{sdk/stateful → stateful}/runtimes/actions.js +8 -8
- package/lib/{sdk/stateful → stateful}/runtimes/apis.d.ts +8 -8
- package/lib/stateful/runtimes/apis.js +5 -0
- package/package.json +12 -10
- package/lib/__tests__/hooks.test.d.ts +0 -1
- package/lib/__tests__/hooks.test.js +0 -19
- package/lib/__tests__/index.test.d.ts +0 -1
- package/lib/__tests__/index.test.js +0 -27
- package/lib/__tests__/integration.test.d.ts +0 -1
- package/lib/__tests__/integration.test.js +0 -57
- package/lib/__tests__/shared/cleanup-shared.d.ts +0 -4
- package/lib/__tests__/shared/cleanup-shared.js +0 -228
- package/lib/__tests__/shared/test-config.d.ts +0 -51
- package/lib/__tests__/shared/test-config.js +0 -110
- package/lib/__tests__/shared/test-constants.d.ts +0 -66
- package/lib/__tests__/shared/test-constants.js +0 -79
- package/lib/__tests__/utils.test.d.ts +0 -1
- package/lib/__tests__/utils.test.js +0 -59
- package/lib/api/__tests__/iam.authentication.integration.test.d.ts +0 -1
- package/lib/api/__tests__/iam.authentication.integration.test.js +0 -247
- package/lib/api/__tests__/iam.healthz.integration.test.d.ts +0 -1
- package/lib/api/__tests__/iam.healthz.integration.test.js +0 -63
- package/lib/api/__tests__/iam.profile.integration.test.d.ts +0 -1
- package/lib/api/__tests__/iam.profile.integration.test.js +0 -252
- package/lib/api/__tests__/runtimes.environments.integration.test.d.ts +0 -1
- package/lib/api/__tests__/runtimes.environments.integration.test.js +0 -122
- package/lib/api/__tests__/runtimes.healthz.integration.test.d.ts +0 -1
- package/lib/api/__tests__/runtimes.healthz.integration.test.js +0 -50
- package/lib/api/__tests__/runtimes.integration.test.d.ts +0 -1
- package/lib/api/__tests__/runtimes.integration.test.js +0 -369
- package/lib/api/__tests__/spacer.healthz.integration.test.d.ts +0 -1
- package/lib/api/__tests__/spacer.healthz.integration.test.js +0 -50
- package/lib/api/__tests__/spacer.integration.test.d.ts +0 -1
- package/lib/api/__tests__/spacer.integration.test.js +0 -519
- package/lib/api/iam/__tests__/authentication.unit.test.d.ts +0 -1
- package/lib/api/iam/__tests__/authentication.unit.test.js +0 -63
- package/lib/api/iam/__tests__/healthz.unit.test.d.ts +0 -1
- package/lib/api/iam/__tests__/healthz.unit.test.js +0 -60
- package/lib/api/iam/__tests__/profile.unit.test.d.ts +0 -1
- package/lib/api/iam/__tests__/profile.unit.test.js +0 -57
- package/lib/api/runtimes/__tests__/environments.unit.test.d.ts +0 -1
- package/lib/api/runtimes/__tests__/environments.unit.test.js +0 -77
- package/lib/api/runtimes/__tests__/healthz.unit.test.d.ts +0 -1
- package/lib/api/runtimes/__tests__/healthz.unit.test.js +0 -57
- package/lib/api/runtimes/__tests__/runtimes.unit.test.d.ts +0 -1
- package/lib/api/runtimes/__tests__/runtimes.unit.test.js +0 -139
- package/lib/api/runtimes/__tests__/snapshots.unit.test.d.ts +0 -1
- package/lib/api/runtimes/__tests__/snapshots.unit.test.js +0 -96
- package/lib/api/spacer/__tests__/healthz.unit.test.d.ts +0 -1
- package/lib/api/spacer/__tests__/healthz.unit.test.js +0 -57
- package/lib/api/spacer/__tests__/items.unit.test.d.ts +0 -1
- package/lib/api/spacer/__tests__/items.unit.test.js +0 -165
- package/lib/api/spacer/__tests__/lexicals.unit.test.d.ts +0 -1
- package/lib/api/spacer/__tests__/lexicals.unit.test.js +0 -323
- package/lib/api/spacer/__tests__/notebooks.unit.test.d.ts +0 -1
- package/lib/api/spacer/__tests__/notebooks.unit.test.js +0 -224
- package/lib/api/spacer/__tests__/users.unit.test.d.ts +0 -1
- package/lib/api/spacer/__tests__/users.unit.test.js +0 -132
- package/lib/api/utils/__tests__/validation.test.d.ts +0 -1
- package/lib/api/utils/__tests__/validation.test.js +0 -109
- package/lib/sdk/client/__tests__/sdk.health.integration.test.d.ts +0 -1
- package/lib/sdk/client/__tests__/sdk.health.integration.test.js +0 -110
- package/lib/sdk/client/__tests__/sdk.iam.integration.test.d.ts +0 -1
- package/lib/sdk/client/__tests__/sdk.iam.integration.test.js +0 -179
- package/lib/sdk/client/__tests__/sdk.models.integration.test.d.ts +0 -1
- package/lib/sdk/client/__tests__/sdk.models.integration.test.js +0 -376
- package/lib/sdk/client/__tests__/sdk.runtimes.integration.test.d.ts +0 -1
- package/lib/sdk/client/__tests__/sdk.runtimes.integration.test.js +0 -276
- package/lib/sdk/client/__tests__/sdk.spacer.integration.test.d.ts +0 -1
- package/lib/sdk/client/__tests__/sdk.spacer.integration.test.js +0 -361
- package/lib/sdk/client/base.d.ts +0 -88
- package/lib/sdk/client/base.js +0 -112
- package/lib/sdk/client/index.d.ts +0 -192
- package/lib/sdk/client/index.js +0 -128
- package/lib/sdk/client/mixins/HealthMixin.d.ts +0 -100
- package/lib/sdk/client/mixins/HealthMixin.js +0 -133
- package/lib/sdk/client/mixins/IAMMixin.d.ts +0 -59
- package/lib/sdk/client/mixins/IAMMixin.js +0 -83
- package/lib/sdk/client/mixins/RuntimesMixin.d.ts +0 -134
- package/lib/sdk/client/mixins/RuntimesMixin.js +0 -221
- package/lib/sdk/client/mixins/SpacerMixin.d.ts +0 -184
- package/lib/sdk/client/mixins/SpacerMixin.js +0 -278
- package/lib/sdk/client/models/Lexical.d.ts +0 -156
- package/lib/sdk/client/models/Lexical.js +0 -275
- package/lib/sdk/client/models/Notebook.d.ts +0 -174
- package/lib/sdk/client/models/Notebook.js +0 -311
- package/lib/sdk/client/models/Runtime.d.ts +0 -221
- package/lib/sdk/client/models/Runtime.js +0 -341
- package/lib/sdk/client/models/Snapshot.d.ts +0 -156
- package/lib/sdk/client/models/Snapshot.js +0 -244
- package/lib/sdk/client/models/Space.d.ts +0 -182
- package/lib/sdk/client/models/Space.js +0 -276
- package/lib/sdk/client/models/__tests__/Lexical.test.d.ts +0 -1
- package/lib/sdk/client/models/__tests__/Lexical.test.js +0 -288
- package/lib/sdk/client/models/__tests__/Notebook.test.d.ts +0 -1
- package/lib/sdk/client/models/__tests__/Notebook.test.js +0 -206
- package/lib/sdk/client/models/__tests__/Runtime.test.d.ts +0 -1
- package/lib/sdk/client/models/__tests__/Runtime.test.js +0 -133
- package/lib/sdk/client/models/__tests__/Snapshot.test.d.ts +0 -1
- package/lib/sdk/client/models/__tests__/Snapshot.test.js +0 -244
- package/lib/sdk/client/models/__tests__/Space.test.d.ts +0 -1
- package/lib/sdk/client/models/__tests__/Space.test.js +0 -334
- package/lib/sdk/client/models/index.d.ts +0 -30
- package/lib/sdk/client/models/index.js +0 -30
- package/lib/sdk/client/utils/mixins.d.ts +0 -42
- /package/lib/{sdk/stateful/runtimes/apis.js → api/types/common.js} +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/exec/Python.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/exec/Python.js +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/exec/index.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/exec/index.js +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/index.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/index.js +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/kernelsHandler.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/jupyter/kernelsHandler.js +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/index.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/index.js +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/settings.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/settings.js +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/snapshots.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/snapshots.js +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/utils.d.ts +0 -0
- /package/lib/{sdk/stateful → stateful}/runtimes/utils.js +0 -0
|
@@ -8,8 +8,8 @@ import { nullTranslator } from '@jupyterlab/translation';
|
|
|
8
8
|
import { ActionList } from '@primer/react';
|
|
9
9
|
import { CloudUploadIcon } from '@datalayer/icons-react';
|
|
10
10
|
import { useCoreStore, useIAMStore } from '../../state';
|
|
11
|
-
import { isRuntimeRemote } from '../../
|
|
12
|
-
import { RuntimeSnippetsFacade } from '../../
|
|
11
|
+
import { isRuntimeRemote } from '../../stateful/runtimes';
|
|
12
|
+
import { RuntimeSnippetsFacade } from '../../stateful/jupyter';
|
|
13
13
|
import { ExternalTokenSilentLogin } from '../../components/iam';
|
|
14
14
|
import { SnippetDialog } from './../snippets/SnippetDialog';
|
|
15
15
|
import { RuntimeLauncherDialog } from './RuntimeLauncherDialog';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ITranslator } from '@jupyterlab/translation';
|
|
2
2
|
import { CommandRegistry } from '@lumino/commands';
|
|
3
|
-
import type { IMultiServiceManager, IDatalayerSessionContext } from '../../
|
|
3
|
+
import type { IMultiServiceManager, IDatalayerSessionContext } from '../../stateful/runtimes';
|
|
4
4
|
import { RuntimeTransfer } from './RuntimeTransfer';
|
|
5
5
|
/**
|
|
6
6
|
* {@link RuntimePickerNotebook} properties
|
|
@@ -9,7 +9,7 @@ import { Box } from '@datalayer/primer-addons';
|
|
|
9
9
|
import { AlertIcon } from '@primer/octicons-react';
|
|
10
10
|
import { JSONExt } from '@lumino/coreutils';
|
|
11
11
|
import { KernelExecutor } from '@datalayer/jupyter-react';
|
|
12
|
-
import { RuntimeSnippetsFacade } from '../../
|
|
12
|
+
import { RuntimeSnippetsFacade } from '../../stateful/jupyter';
|
|
13
13
|
import { ExternalTokenSilentLogin } from '../../components/iam';
|
|
14
14
|
import { useCoreStore, useIAMStore } from '../../state';
|
|
15
15
|
import { RuntimeReservationControl, MAXIMAL_RUNTIME_TIME_RESERVATION_MINUTES, } from './RuntimeReservationControl';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SessionContext } from '@jupyterlab/apputils';
|
|
2
2
|
import { ITranslator } from '@jupyterlab/translation';
|
|
3
|
-
import { IMultiServiceManager } from '../../
|
|
3
|
+
import { IMultiServiceManager } from '../../stateful/runtimes';
|
|
4
4
|
import { IRuntimeDesc } from '../../models';
|
|
5
5
|
export type IDatalayerRuntimeDesc = IRuntimeDesc & {
|
|
6
6
|
gpu?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PropsWithChildren } from 'react';
|
|
2
2
|
import { Kernel } from '@jupyterlab/services';
|
|
3
|
-
import { IMultiServiceManager } from '../../
|
|
3
|
+
import { IMultiServiceManager } from '../../stateful/runtimes';
|
|
4
4
|
/**
|
|
5
5
|
* Runtime snapshot menu component properties
|
|
6
6
|
*/
|
|
@@ -5,10 +5,11 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
5
5
|
*/
|
|
6
6
|
import { useCallback, useEffect, useState, } from 'react';
|
|
7
7
|
import { CameraIcon } from '@datalayer/icons-react';
|
|
8
|
-
import { ActionList, ActionMenu,
|
|
8
|
+
import { ActionList, ActionMenu, Flash, FormControl, Select, Spinner, } from '@primer/react';
|
|
9
9
|
import { Dialog } from '@primer/react/experimental';
|
|
10
|
+
import { Box } from '@datalayer/primer-addons';
|
|
10
11
|
import { useToast } from '../../hooks';
|
|
11
|
-
import { createRuntimeSnapshot, getRuntimeSnapshots, loadBrowserRuntimeSnapshot, loadRuntimeSnapshot, } from '../../
|
|
12
|
+
import { createRuntimeSnapshot, getRuntimeSnapshots, loadBrowserRuntimeSnapshot, loadRuntimeSnapshot, } from '../../stateful/runtimes';
|
|
12
13
|
import { useRuntimesStore } from '../../state';
|
|
13
14
|
import { createRuntimeSnapshotName } from '../../utils';
|
|
14
15
|
/**
|
|
@@ -17,10 +18,10 @@ import { createRuntimeSnapshotName } from '../../utils';
|
|
|
17
18
|
export function RuntimeSnapshotMenu(props) {
|
|
18
19
|
const { children, connection, podName, multiServiceManager, disabled } = props;
|
|
19
20
|
const { addRuntimeSnapshot, runtimesRunUrl, runtimeSnapshots, setRuntimeSnapshots, } = useRuntimesStore();
|
|
20
|
-
const { trackAsyncTask } = useToast();
|
|
21
|
+
const { enqueueToast, trackAsyncTask } = useToast();
|
|
21
22
|
const [openLoadDialog, setOpenLoadDialog] = useState(false);
|
|
22
|
-
const [
|
|
23
|
-
const [
|
|
23
|
+
const [loadingRuntimeSnapshot, setLoadingRuntimeSnapshot] = useState(false);
|
|
24
|
+
const [takingRuntimeSnapshot, setTakingRuntimeSnapshot] = useState(false);
|
|
24
25
|
const [selection, setSelection] = useState(runtimeSnapshots[0]?.id ?? '');
|
|
25
26
|
const [error, setError] = useState();
|
|
26
27
|
useEffect(() => {
|
|
@@ -35,31 +36,37 @@ export function RuntimeSnapshotMenu(props) {
|
|
|
35
36
|
console.error(`Failed to fetch remote kernel snapshots; ${reason}`);
|
|
36
37
|
});
|
|
37
38
|
}, [runtimesRunUrl]);
|
|
38
|
-
const
|
|
39
|
+
const onLoadRuntimeSnapshot = useCallback(() => {
|
|
39
40
|
setError(undefined);
|
|
40
41
|
setOpenLoadDialog(true);
|
|
41
42
|
}, []);
|
|
42
|
-
const
|
|
43
|
+
const onRuntimeSnapshotChanged = useCallback(event => {
|
|
43
44
|
setSelection(event.target.value);
|
|
44
45
|
}, []);
|
|
45
|
-
const
|
|
46
|
+
const onLoadRuntimeSnapshotSubmit = useCallback(async ({ id, connection, podName, }) => {
|
|
46
47
|
if (podName) {
|
|
47
48
|
await loadRuntimeSnapshot({ id: podName, from: id });
|
|
49
|
+
enqueueToast(`Runtime snapshot ${podName} is loaded.`, {
|
|
50
|
+
variant: 'success',
|
|
51
|
+
});
|
|
48
52
|
}
|
|
49
53
|
else if (connection) {
|
|
50
54
|
await loadBrowserRuntimeSnapshot({ connection, id });
|
|
55
|
+
enqueueToast(`Runtime snapshot ${id} is loaded.`, {
|
|
56
|
+
variant: 'success',
|
|
57
|
+
});
|
|
51
58
|
}
|
|
52
59
|
}, []);
|
|
53
|
-
const
|
|
60
|
+
const onTakeRuntimeSnapshot = useCallback(async () => {
|
|
54
61
|
try {
|
|
55
|
-
|
|
62
|
+
setTakingRuntimeSnapshot(true);
|
|
56
63
|
let snapshot;
|
|
57
64
|
let task;
|
|
58
65
|
let ref = '';
|
|
59
66
|
let snapshotName = '';
|
|
60
67
|
if (podName && multiServiceManager?.remote) {
|
|
61
68
|
snapshotName = createRuntimeSnapshotName('cloud');
|
|
62
|
-
task = multiServiceManager.remote.runtimesManager.
|
|
69
|
+
task = multiServiceManager.remote.runtimesManager.snapshotRuntime({
|
|
63
70
|
podName,
|
|
64
71
|
name: snapshotName,
|
|
65
72
|
description: snapshotName,
|
|
@@ -97,7 +104,7 @@ export function RuntimeSnapshotMenu(props) {
|
|
|
97
104
|
message: (reason, data) => {
|
|
98
105
|
const msg = reason === 'Empty snapshot'
|
|
99
106
|
? `Runtime ${ref} will not be snapshotted as it does not contain any serializable state.`
|
|
100
|
-
: `Failed to
|
|
107
|
+
: `Failed to snapshot runtime ${ref} - ${reason}`;
|
|
101
108
|
return msg;
|
|
102
109
|
},
|
|
103
110
|
},
|
|
@@ -113,10 +120,10 @@ export function RuntimeSnapshotMenu(props) {
|
|
|
113
120
|
}
|
|
114
121
|
}
|
|
115
122
|
finally {
|
|
116
|
-
|
|
123
|
+
setTakingRuntimeSnapshot(false);
|
|
117
124
|
}
|
|
118
125
|
}, [connection, podName, multiServiceManager]);
|
|
119
|
-
return (_jsxs(_Fragment, { children: [_jsxs(ActionMenu, { children: [_jsx(ActionMenu.Button, { leadingVisual: CameraIcon, variant: "invisible", size: "small", disabled:
|
|
126
|
+
return (_jsxs(_Fragment, { children: [_jsxs(ActionMenu, { children: [_jsx(ActionMenu.Button, { leadingVisual: CameraIcon, variant: "invisible", size: "small", disabled: loadingRuntimeSnapshot || takingRuntimeSnapshot || disabled, children: children }), _jsx(ActionMenu.Overlay, { children: _jsxs(ActionList, { children: [_jsx(ActionList.Item, { onSelect: onLoadRuntimeSnapshot, disabled: loadingRuntimeSnapshot || runtimeSnapshots.length === 0, children: "Load a runtime snapshot\u2026" }), _jsx(ActionList.Item, { onSelect: onTakeRuntimeSnapshot, disabled: takingRuntimeSnapshot, children: "Take a runtime snapshot" })] }) })] }), openLoadDialog && (_jsx(Dialog, { title: _jsx("span", { style: { color: 'var(--fgColor-default)' }, children: "Choose a runtime snapshot to load" }), onClose: () => {
|
|
120
127
|
setOpenLoadDialog(false);
|
|
121
128
|
}, footerButtons: [
|
|
122
129
|
{
|
|
@@ -131,17 +138,17 @@ export function RuntimeSnapshotMenu(props) {
|
|
|
131
138
|
},
|
|
132
139
|
{
|
|
133
140
|
buttonType: 'primary',
|
|
134
|
-
content:
|
|
135
|
-
disabled:
|
|
141
|
+
content: loadingRuntimeSnapshot ? (_jsx(Spinner, { size: "small" })) : ('Load'),
|
|
142
|
+
disabled: loadingRuntimeSnapshot,
|
|
136
143
|
onClick: async (event) => {
|
|
137
144
|
if (!event.defaultPrevented) {
|
|
138
145
|
event.preventDefault();
|
|
139
|
-
|
|
146
|
+
setLoadingRuntimeSnapshot(true);
|
|
140
147
|
try {
|
|
141
148
|
setError(undefined);
|
|
142
149
|
const snapshot = runtimeSnapshots.find(s => s.id === selection);
|
|
143
150
|
if (snapshot && (connection || podName)) {
|
|
144
|
-
await
|
|
151
|
+
await onLoadRuntimeSnapshotSubmit({
|
|
145
152
|
connection,
|
|
146
153
|
id: snapshot.id,
|
|
147
154
|
podName,
|
|
@@ -152,14 +159,14 @@ export function RuntimeSnapshotMenu(props) {
|
|
|
152
159
|
}
|
|
153
160
|
}
|
|
154
161
|
finally {
|
|
155
|
-
|
|
162
|
+
setLoadingRuntimeSnapshot(false);
|
|
156
163
|
setOpenLoadDialog(false);
|
|
157
164
|
}
|
|
158
165
|
}
|
|
159
166
|
},
|
|
160
167
|
autoFocus: true,
|
|
161
168
|
},
|
|
162
|
-
], children: _jsxs(Box, { as: "form", children: [_jsxs(FormControl, { children: [_jsx(FormControl.Label, { children: "Snapshot" }), _jsx(Select, { name: "snapshot", value: selection, onChange:
|
|
169
|
+
], children: _jsxs(Box, { as: "form", children: [_jsxs(FormControl, { children: [_jsx(FormControl.Label, { children: "Snapshot" }), _jsx(Select, { name: "snapshot", value: selection, onChange: onRuntimeSnapshotChanged, block: true, children: runtimeSnapshots.map(s => (_jsx(Select.Option, { value: s.id, children: s.name ? `${s.name} (${s.id})` : s.id }, s.id))) })] }), error && _jsx(Flash, { variant: "danger", children: error })] }) }))] }));
|
|
163
170
|
}
|
|
164
171
|
RuntimeSnapshotMenu.defaultProps = {
|
|
165
172
|
disabled: false,
|
|
@@ -63,6 +63,14 @@ export type IDatalayerCoreConfig = {
|
|
|
63
63
|
* AI Agents API URL.
|
|
64
64
|
*/
|
|
65
65
|
aiagentsRunUrl: string;
|
|
66
|
+
/**
|
|
67
|
+
* AI Inference API URL.
|
|
68
|
+
*/
|
|
69
|
+
aiinferenceRunUrl: string;
|
|
70
|
+
/**
|
|
71
|
+
* MCP Servers API URL.
|
|
72
|
+
*/
|
|
73
|
+
mcpserversRunUrl: string;
|
|
66
74
|
/**
|
|
67
75
|
* Growth API URL.
|
|
68
76
|
*/
|
|
@@ -36,7 +36,7 @@ export function useDatalayer(props = {}) {
|
|
|
36
36
|
if (error.name === 'RunResponseError') {
|
|
37
37
|
const responseError = error;
|
|
38
38
|
if (responseError.response.status === 401) {
|
|
39
|
-
console.log('Datalayer
|
|
39
|
+
console.log('Datalayer sent a 401 return code.');
|
|
40
40
|
if (location.pathname !== loginRoute_) {
|
|
41
41
|
iamStore.logout();
|
|
42
42
|
navigate(loginRoute_);
|
package/lib/hooks/useRuntimes.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
import { requestJupyterKernelsExtension } from '../
|
|
5
|
+
import { requestJupyterKernelsExtension } from '../stateful/jupyter/kernelsHandler';
|
|
6
6
|
export const useRuntimes = () => {
|
|
7
7
|
// Folder Mounting ----------------------------------------------------------
|
|
8
8
|
const mountLocalFolder = (kernelId) => {
|
package/lib/hooks/useToast.js
CHANGED
|
@@ -41,7 +41,7 @@ function createContent(message, closeHandler, actions) {
|
|
|
41
41
|
})] }))] }));
|
|
42
42
|
}
|
|
43
43
|
export const useToast = () => {
|
|
44
|
-
// This CANNOT use React hooks as it
|
|
44
|
+
// This CANNOT use Jupyter React hooks as it may be used outside Jupyter React context.
|
|
45
45
|
const insideJupyterLab = isInsideJupyterLab();
|
|
46
46
|
const enqueueToast = (message, options = { variant: 'info' }) => {
|
|
47
47
|
const { actions, autoClose } = options;
|
package/lib/index.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ export * from './api/types';
|
|
|
11
11
|
export * as runtimesApi from './api/runtimes';
|
|
12
12
|
export * as iamApi from './api/iam';
|
|
13
13
|
export * as spacerApi from './api/spacer';
|
|
14
|
-
export {
|
|
15
|
-
export { getEnvironments, createRuntime, getRuntimes, deleteRuntime, snapshotRuntime, getRuntimeSnapshots, loadRuntimeSnapshot, } from './
|
|
14
|
+
export { DatalayerClient, type DatalayerClientConfig, type SDKHandlers, User, Runtime, Environment, Snapshot, Space, Notebook, Lexical, Credits, Item, type RuntimeJSON, type EnvironmentJSON, type UserJSON, } from './client';
|
|
15
|
+
export { getEnvironments, createRuntime, getRuntimes, deleteRuntime, snapshotRuntime, getRuntimeSnapshots, loadRuntimeSnapshot, } from './stateful/runtimes/actions';
|
package/lib/index.js
CHANGED
|
@@ -16,6 +16,8 @@ export * from './api/types';
|
|
|
16
16
|
export * as runtimesApi from './api/runtimes';
|
|
17
17
|
export * as iamApi from './api/iam';
|
|
18
18
|
export * as spacerApi from './api/spacer';
|
|
19
|
-
export {
|
|
19
|
+
export { DatalayerClient,
|
|
20
|
+
// Export SDK models
|
|
21
|
+
User, Runtime, Environment, Snapshot, Space, Notebook, Lexical, Credits, Item, } from './client';
|
|
20
22
|
// Export commonly used SDK functions directly for convenience
|
|
21
|
-
export { getEnvironments, createRuntime, getRuntimes, deleteRuntime, snapshotRuntime, getRuntimeSnapshots, loadRuntimeSnapshot, } from './
|
|
23
|
+
export { getEnvironments, createRuntime, getRuntimes, deleteRuntime, snapshotRuntime, getRuntimeSnapshots, loadRuntimeSnapshot, } from './stateful/runtimes/actions';
|
package/lib/sdk/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @description Main SDK entry point for the Datalayer platform.
|
|
2
|
+
* Main SDK entry point for the Datalayer platform.
|
|
4
3
|
*
|
|
5
4
|
* This module provides the unified DatalayerSDK class with a flat, intuitive API
|
|
6
5
|
* for all Datalayer platform services. The SDK uses TypeScript mixins to provide
|
|
@@ -21,6 +20,8 @@
|
|
|
21
20
|
* const runtime = await sdk.createRuntime(config);
|
|
22
21
|
* const notebook = await sdk.createNotebook(data);
|
|
23
22
|
* ```
|
|
23
|
+
*
|
|
24
|
+
* @module sdk
|
|
24
25
|
*/
|
|
25
|
-
export {
|
|
26
|
-
export * from '
|
|
26
|
+
export { DatalayerClient, type DatalayerClientConfig } from '../client';
|
|
27
|
+
export * from '../stateful';
|
package/lib/sdk/index.js
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* @description Main SDK entry point for the Datalayer platform.
|
|
6
|
+
* Main SDK entry point for the Datalayer platform.
|
|
8
7
|
*
|
|
9
8
|
* This module provides the unified DatalayerSDK class with a flat, intuitive API
|
|
10
9
|
* for all Datalayer platform services. The SDK uses TypeScript mixins to provide
|
|
@@ -25,8 +24,10 @@
|
|
|
25
24
|
* const runtime = await sdk.createRuntime(config);
|
|
26
25
|
* const notebook = await sdk.createNotebook(data);
|
|
27
26
|
* ```
|
|
27
|
+
*
|
|
28
|
+
* @module sdk
|
|
28
29
|
*/
|
|
29
|
-
// Export the main
|
|
30
|
-
export {
|
|
30
|
+
// Export the main Client class with flat API
|
|
31
|
+
export { DatalayerClient } from '../client';
|
|
31
32
|
// Export stateful modules for advanced use cases
|
|
32
|
-
export * from '
|
|
33
|
+
export * from '../stateful';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { ServerConnection, ServiceManager } from '@jupyterlab/services';
|
|
6
6
|
import { coreStore } from '../state/substates/CoreState';
|
|
7
7
|
import { DEFAULT_DATALAYER_CONFIG } from '../config/Configuration';
|
|
8
|
-
import { createRuntime } from '../
|
|
8
|
+
import { createRuntime } from '../stateful/runtimes/actions';
|
|
9
9
|
/**
|
|
10
10
|
* Creates a ServiceManager configured for Datalayer.
|
|
11
11
|
*
|
|
@@ -21,6 +21,8 @@ let initialConfiguration = {
|
|
|
21
21
|
libraryRunUrl: 'https://prod1.datalayer.run',
|
|
22
22
|
spacerRunUrl: 'https://prod1.datalayer.run',
|
|
23
23
|
aiagentsRunUrl: 'https://prod1.datalayer.run',
|
|
24
|
+
aiinferenceRunUrl: 'https://prod1.datalayer.run',
|
|
25
|
+
mcpserversRunUrl: 'https://prod1.datalayer.run',
|
|
24
26
|
growthRunUrl: 'https://prod1.datalayer.run',
|
|
25
27
|
inboundsRunUrl: 'https://prod1.datalayer.run',
|
|
26
28
|
successRunUrl: 'https://prod1.datalayer.run',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IMultiServiceManager } from '../../
|
|
1
|
+
import type { IMultiServiceManager } from '../../stateful/runtimes';
|
|
2
2
|
import type { IRuntimesConfiguration } from '../../config';
|
|
3
3
|
import type { IRuntimePod, IRuntimeSnapshot, IRuntimeModel } from '../../models';
|
|
4
4
|
/**
|
|
@@ -6,7 +6,7 @@ import { useStore } from 'zustand';
|
|
|
6
6
|
import { createStore } from 'zustand/vanilla';
|
|
7
7
|
import { JSONExt } from '@lumino/coreutils';
|
|
8
8
|
import { Poll } from '@lumino/polling';
|
|
9
|
-
import { getRuntimes } from '../../
|
|
9
|
+
import { getRuntimes } from '../../stateful/runtimes';
|
|
10
10
|
import { coreStore } from './CoreState';
|
|
11
11
|
import { iamStore } from './IAMState';
|
|
12
12
|
/**
|
|
@@ -5,11 +5,6 @@ export interface IRuntimeSnippets {
|
|
|
5
5
|
/**
|
|
6
6
|
* Code snippet to change the current working directory.
|
|
7
7
|
*
|
|
8
|
-
* The code snippet has no returned value.
|
|
9
|
-
*
|
|
10
|
-
* The path is relative to the home directory and use
|
|
11
|
-
* the separator `/`.
|
|
12
|
-
*
|
|
13
8
|
* @param path New current directory
|
|
14
9
|
* @returns The code snippet
|
|
15
10
|
*/
|
|
@@ -17,21 +12,12 @@ export interface IRuntimeSnippets {
|
|
|
17
12
|
/**
|
|
18
13
|
* Code snippet to list the transferable kernel variables.
|
|
19
14
|
*
|
|
20
|
-
* The code snippet must return a serialized-JSON
|
|
21
|
-
* dictionary (<variable name>, <variable type>)
|
|
22
|
-
*
|
|
23
15
|
* @returns The code snippet
|
|
24
16
|
*/
|
|
25
17
|
listVariables(): string;
|
|
26
18
|
/**
|
|
27
19
|
* Code snippet to load kernel variables.
|
|
28
20
|
*
|
|
29
|
-
* The code snippet must return a serialized-JSON list
|
|
30
|
-
* with successfully loaded variables.
|
|
31
|
-
*
|
|
32
|
-
* The format used to store the variable value is up to the kernel.
|
|
33
|
-
* It should JSON-serializable and will be passed from {@link saveVariables}.
|
|
34
|
-
*
|
|
35
21
|
* @param variables Serialized-JSON dictionary (<variable name>, <variable value blob>)
|
|
36
22
|
* @returns The code snippet
|
|
37
23
|
*/
|
|
@@ -39,13 +25,6 @@ export interface IRuntimeSnippets {
|
|
|
39
25
|
/**
|
|
40
26
|
* Code snippet to save kernel variables.
|
|
41
27
|
*
|
|
42
|
-
* The code snippet must return a serialized-JSON dictionary
|
|
43
|
-
* (<variable name>, <variable value blob>).
|
|
44
|
-
*
|
|
45
|
-
* The format used to store the variable value is up to the kernel.
|
|
46
|
-
* It should JSON-serializable and will be passed to {@link loadVariables}
|
|
47
|
-
* without modification.
|
|
48
|
-
*
|
|
49
28
|
* @param variables Variable names.
|
|
50
29
|
* @returns The code snippet
|
|
51
30
|
*/
|
|
@@ -78,10 +57,7 @@ export declare class RuntimeSnippetsFacade {
|
|
|
78
57
|
static supports(language: string): boolean;
|
|
79
58
|
private _language;
|
|
80
59
|
/**
|
|
81
|
-
* Create a kernel snippet generator for a given kernel
|
|
82
|
-
* language.
|
|
83
|
-
*
|
|
84
|
-
* It will raise if the language is not available.
|
|
60
|
+
* Create a kernel snippet generator for a given kernel language.
|
|
85
61
|
*
|
|
86
62
|
* @param language Kernel language
|
|
87
63
|
*/
|
|
@@ -102,21 +78,12 @@ export declare class RuntimeSnippetsFacade {
|
|
|
102
78
|
/**
|
|
103
79
|
* Code snippet to list the transferable kernel variables.
|
|
104
80
|
*
|
|
105
|
-
* The code snippet must return a serialized-JSON
|
|
106
|
-
* dictionary (<variable name>, <variable type>)
|
|
107
|
-
*
|
|
108
81
|
* @returns The code snippet
|
|
109
82
|
*/
|
|
110
83
|
listVariables(): string;
|
|
111
84
|
/**
|
|
112
85
|
* Code snippet to load kernel variables.
|
|
113
86
|
*
|
|
114
|
-
* The code snippet must return a serialized-JSON list
|
|
115
|
-
* with successfully loaded variables.
|
|
116
|
-
*
|
|
117
|
-
* The format used to store the variable value is up to the kernel.
|
|
118
|
-
* It should JSON-serializable and will be passed from {@link saveVariables}.
|
|
119
|
-
*
|
|
120
87
|
* @param variables Serialized-JSON dictionary (<variable name>, <variable value blob>)
|
|
121
88
|
* @returns The code snippet
|
|
122
89
|
*/
|
|
@@ -124,13 +91,6 @@ export declare class RuntimeSnippetsFacade {
|
|
|
124
91
|
/**
|
|
125
92
|
* Code snippet to save kernel variables.
|
|
126
93
|
*
|
|
127
|
-
* The code snippet must return a serialized-JSON dictionary
|
|
128
|
-
* (<variable name>, <variable value blob>).
|
|
129
|
-
*
|
|
130
|
-
* The format used to store the variable value is up to the kernel.
|
|
131
|
-
* It should JSON-serializable and will be passed to {@link loadVariables}
|
|
132
|
-
* without modification.
|
|
133
|
-
*
|
|
134
94
|
* @param variables Variable names.
|
|
135
95
|
* @returns The code snippet
|
|
136
96
|
*/
|
|
@@ -27,10 +27,7 @@ export class RuntimeSnippetsFacade {
|
|
|
27
27
|
}
|
|
28
28
|
_language;
|
|
29
29
|
/**
|
|
30
|
-
* Create a kernel snippet generator for a given kernel
|
|
31
|
-
* language.
|
|
32
|
-
*
|
|
33
|
-
* It will raise if the language is not available.
|
|
30
|
+
* Create a kernel snippet generator for a given kernel language.
|
|
34
31
|
*
|
|
35
32
|
* @param language Kernel language
|
|
36
33
|
*/
|
|
@@ -62,9 +59,6 @@ export class RuntimeSnippetsFacade {
|
|
|
62
59
|
/**
|
|
63
60
|
* Code snippet to list the transferable kernel variables.
|
|
64
61
|
*
|
|
65
|
-
* The code snippet must return a serialized-JSON
|
|
66
|
-
* dictionary (<variable name>, <variable type>)
|
|
67
|
-
*
|
|
68
62
|
* @returns The code snippet
|
|
69
63
|
*/
|
|
70
64
|
listVariables() {
|
|
@@ -73,12 +67,6 @@ export class RuntimeSnippetsFacade {
|
|
|
73
67
|
/**
|
|
74
68
|
* Code snippet to load kernel variables.
|
|
75
69
|
*
|
|
76
|
-
* The code snippet must return a serialized-JSON list
|
|
77
|
-
* with successfully loaded variables.
|
|
78
|
-
*
|
|
79
|
-
* The format used to store the variable value is up to the kernel.
|
|
80
|
-
* It should JSON-serializable and will be passed from {@link saveVariables}.
|
|
81
|
-
*
|
|
82
70
|
* @param variables Serialized-JSON dictionary (<variable name>, <variable value blob>)
|
|
83
71
|
* @returns The code snippet
|
|
84
72
|
*/
|
|
@@ -90,13 +78,6 @@ export class RuntimeSnippetsFacade {
|
|
|
90
78
|
/**
|
|
91
79
|
* Code snippet to save kernel variables.
|
|
92
80
|
*
|
|
93
|
-
* The code snippet must return a serialized-JSON dictionary
|
|
94
|
-
* (<variable name>, <variable value blob>).
|
|
95
|
-
*
|
|
96
|
-
* The format used to store the variable value is up to the kernel.
|
|
97
|
-
* It should JSON-serializable and will be passed to {@link loadVariables}
|
|
98
|
-
* without modification.
|
|
99
|
-
*
|
|
100
81
|
* @param variables Variable names.
|
|
101
82
|
* @returns The code snippet
|
|
102
83
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IRuntimeOptions } from '..';
|
|
2
|
-
import type { IRuntimeSnapshot, IDatalayerEnvironment, IRuntimePod } from '
|
|
2
|
+
import type { IRuntimeSnapshot, IDatalayerEnvironment, IRuntimePod } from '../../models';
|
|
3
3
|
/**
|
|
4
4
|
* Get available Environments.
|
|
5
5
|
*/
|
|
@@ -42,7 +42,7 @@ export declare function snapshotRuntime(options: {
|
|
|
42
42
|
*/
|
|
43
43
|
description?: string;
|
|
44
44
|
/**
|
|
45
|
-
* Whether to stop the
|
|
45
|
+
* Whether to stop the runtime after the snapshot completion or not.
|
|
46
46
|
*/
|
|
47
47
|
stop?: boolean;
|
|
48
48
|
}): Promise<IRuntimeSnapshot>;
|
|
@@ -51,7 +51,7 @@ export declare function snapshotRuntime(options: {
|
|
|
51
51
|
*/
|
|
52
52
|
export declare function getRuntimeSnapshots(): Promise<IRuntimeSnapshot[]>;
|
|
53
53
|
/**
|
|
54
|
-
* Load a Runtime Snapshot within a
|
|
54
|
+
* Load a Runtime Snapshot within a Runtime.
|
|
55
55
|
*/
|
|
56
56
|
export declare function loadRuntimeSnapshot(options: {
|
|
57
57
|
/**
|
|
@@ -9,9 +9,9 @@ import { URLExt } from '@jupyterlab/coreutils';
|
|
|
9
9
|
import { PromiseDelegate } from '@lumino/coreutils';
|
|
10
10
|
import { Upload } from 'tus-js-client';
|
|
11
11
|
import { requestDatalayerAPI, } from '..';
|
|
12
|
-
import { asRuntimeSnapshot } from '
|
|
13
|
-
import { iamStore, runtimesStore } from '
|
|
14
|
-
import { sleep } from '
|
|
12
|
+
import { asRuntimeSnapshot } from '../../models';
|
|
13
|
+
import { iamStore, runtimesStore } from '../../state';
|
|
14
|
+
import { sleep } from '../../utils';
|
|
15
15
|
/**
|
|
16
16
|
* Get available Environments.
|
|
17
17
|
*/
|
|
@@ -111,7 +111,7 @@ export async function snapshotRuntime(options) {
|
|
|
111
111
|
token: iamStore.getState().token,
|
|
112
112
|
});
|
|
113
113
|
if (!data.success || !data.snapshot) {
|
|
114
|
-
throw new Error(`Failed to
|
|
114
|
+
throw new Error(`Failed to take the runtime snapshot ${options.id} - ${data}`);
|
|
115
115
|
}
|
|
116
116
|
return asRuntimeSnapshot(data.snapshot);
|
|
117
117
|
}
|
|
@@ -124,13 +124,13 @@ export async function getRuntimeSnapshots() {
|
|
|
124
124
|
token: iamStore.getState().token,
|
|
125
125
|
});
|
|
126
126
|
if (!data.success) {
|
|
127
|
-
console.error('Failed to fetch
|
|
127
|
+
console.error('Failed to fetch runtime snapshots.', data);
|
|
128
128
|
return [];
|
|
129
129
|
}
|
|
130
130
|
return (data.snapshots ?? []).map(asRuntimeSnapshot);
|
|
131
131
|
}
|
|
132
132
|
/**
|
|
133
|
-
* Load a Runtime Snapshot within a
|
|
133
|
+
* Load a Runtime Snapshot within a Runtime.
|
|
134
134
|
*/
|
|
135
135
|
export async function loadRuntimeSnapshot(options) {
|
|
136
136
|
const data = await requestDatalayerAPI({
|
|
@@ -142,7 +142,7 @@ export async function loadRuntimeSnapshot(options) {
|
|
|
142
142
|
token: iamStore.getState().token,
|
|
143
143
|
});
|
|
144
144
|
if (!data.success) {
|
|
145
|
-
throw new Error(`Failed to load the
|
|
145
|
+
throw new Error(`Failed to load the runtime snapshot; ${data.message}`);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
/**
|
|
@@ -181,7 +181,7 @@ export async function deleteRuntimeSnapshot(id) {
|
|
|
181
181
|
method: 'DELETE',
|
|
182
182
|
token: iamStore.getState().token,
|
|
183
183
|
});
|
|
184
|
-
// Poll Runtime Snapshot state up-to its deletion
|
|
184
|
+
// Poll Runtime Snapshot state up-to its deletion.
|
|
185
185
|
try {
|
|
186
186
|
let sleepTimeout = 1000;
|
|
187
187
|
while (true) {
|
|
@@ -5,7 +5,7 @@ import { ISessionContext } from '@jupyterlab/apputils';
|
|
|
5
5
|
import { ServiceManager, Kernel, ServerConnection } from '@jupyterlab/services';
|
|
6
6
|
import { IDisposable } from '@lumino/disposable';
|
|
7
7
|
import { ISignal } from '@lumino/signaling';
|
|
8
|
-
import type { IRuntimeSnapshot, IRuntimeCapabilities, IRuntimeModel, IDatalayerEnvironment, IRuntimeType, IRuntimeLocation } from '
|
|
8
|
+
import type { IRuntimeSnapshot, IRuntimeCapabilities, IRuntimeModel, IDatalayerEnvironment, IRuntimeType, IRuntimeLocation } from '../../models';
|
|
9
9
|
/**
|
|
10
10
|
* Abstract interface for the Datalayer session context.
|
|
11
11
|
* It extends the JupyterLab session context
|
|
@@ -160,16 +160,16 @@ export interface IRemoteRuntimesManager extends IDisposable {
|
|
|
160
160
|
*/
|
|
161
161
|
refreshKernels(): Promise<void>;
|
|
162
162
|
/**
|
|
163
|
-
* Snapshot a
|
|
163
|
+
* Snapshot a runtime
|
|
164
164
|
*
|
|
165
|
-
* The
|
|
165
|
+
* The runtime may be given by its `id` or `podName`.
|
|
166
166
|
* A custom description for the snapshot can be provided.
|
|
167
167
|
*
|
|
168
168
|
* @returns The snapshot description
|
|
169
169
|
*/
|
|
170
|
-
|
|
170
|
+
snapshotRuntime(options: {
|
|
171
171
|
/**
|
|
172
|
-
* The
|
|
172
|
+
* The runtime id to snapshot
|
|
173
173
|
*/
|
|
174
174
|
id?: string;
|
|
175
175
|
/**
|
|
@@ -190,11 +190,11 @@ export interface IRemoteRuntimesManager extends IDisposable {
|
|
|
190
190
|
stop?: boolean;
|
|
191
191
|
}): Promise<IRuntimeSnapshot | undefined>;
|
|
192
192
|
/**
|
|
193
|
-
* Load a snapshot within a
|
|
193
|
+
* Load a snapshot within a runtim
|
|
194
194
|
*
|
|
195
|
-
* The
|
|
195
|
+
* The runtime may be given by its `id` or `podName`.
|
|
196
196
|
*/
|
|
197
|
-
|
|
197
|
+
loadRuntimeSnapshot(options: {
|
|
198
198
|
/**
|
|
199
199
|
* The kernel id
|
|
200
200
|
*/
|