1 |
|
2 |
|
3 |
|
4 |
|
5 | import { ServiceManager } from '@jupyterlab/services';
|
6 | import { UUID } from '@lumino/coreutils';
|
7 | import { SessionContext } from './sessioncontext';
|
8 |
|
9 |
|
10 |
|
11 | export async function createSessionContext(options = {}) {
|
12 | var _a, _b, _c, _d, _e;
|
13 | const manager = (_a = options.sessionManager) !== null && _a !== void 0 ? _a : Private.getManager().sessions;
|
14 | const specsManager = (_b = options.specsManager) !== null && _b !== void 0 ? _b : Private.getManager().kernelspecs;
|
15 | await Promise.all([manager.ready, specsManager.ready]);
|
16 | return new SessionContext({
|
17 | sessionManager: manager,
|
18 | specsManager,
|
19 | path: (_c = options.path) !== null && _c !== void 0 ? _c : UUID.uuid4(),
|
20 | name: options.name,
|
21 | type: options.type,
|
22 | kernelPreference: (_d = options.kernelPreference) !== null && _d !== void 0 ? _d : {
|
23 | shouldStart: true,
|
24 | canStart: true,
|
25 | name: (_e = specsManager.specs) === null || _e === void 0 ? void 0 : _e.default
|
26 | }
|
27 | });
|
28 | }
|
29 |
|
30 |
|
31 |
|
32 | var Private;
|
33 | (function (Private) {
|
34 | let manager;
|
35 | |
36 |
|
37 |
|
38 | function getManager() {
|
39 | if (!manager) {
|
40 | manager = new ServiceManager({ standby: 'never' });
|
41 | }
|
42 | return manager;
|
43 | }
|
44 | Private.getManager = getManager;
|
45 | })(Private || (Private = {}));
|
46 |
|
\ | No newline at end of file |