CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/project/init-kucalc.ts
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { init as initJupyterPool } from "@cocalc/jupyter/pool/pool";
7
import { init as initJupyterPoolParams } from "@cocalc/jupyter/pool/pool-params";
8
import { activate as initAutorenice } from "./autorenice";
9
import * as dedicatedDisks from "./dedicated-disks";
10
import { getOptions } from "./init-program";
11
import * as initScript from "./init-script";
12
import * as kucalc from "./kucalc";
13
import { getLogger } from "./logger";
14
import * as projectSetup from "./project-setup";
15
import * as sshd from "./sshd";
16
17
export default async function init() {
18
const winston = getLogger("init kucalc");
19
const options = getOptions();
20
winston.info("initializing state related to KuCalc");
21
if (options.kucalc) {
22
winston.info("running in kucalc");
23
kucalc.setInKucalc(true);
24
} else {
25
winston.info("NOT running in kucalc");
26
kucalc.setInKucalc(false);
27
}
28
29
if (process.env.COCALC_PROJECT_AUTORENICE != null || options.kucalc) {
30
initAutorenice();
31
}
32
33
projectSetup.configure();
34
const envVars = projectSetup.set_extra_env();
35
36
if (options.sshd) {
37
sshd.init(envVars);
38
}
39
40
// this must come after projectSetup.set_extra_env !
41
initJupyterPoolParams();
42
43
await dedicatedDisks.init();
44
45
initScript.run();
46
47
// this has to come after setting env vars and intializing the pool params
48
initJupyterPool();
49
}
50
51