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/next/components/store/quota-config-presets.tsx
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 { IconName } from "@cocalc/frontend/components/icon";
7
import { Uptime } from "@cocalc/util/consts/site-license";
8
import { Paragraph } from "components/misc";
9
import A from "components/misc/A";
10
import { ReactNode } from "react";
11
12
export type Preset = "standard" | "instructor" | "research";
13
14
// Fields to be used to match a configured license against a pre-existing preset.
15
//
16
export const PRESET_MATCH_FIELDS: Record<string, string> = {
17
cpu: "CPU count",
18
disk: "disk space",
19
ram: "memory",
20
uptime: "idle timeout",
21
member: "member hosting",
22
};
23
24
export interface PresetConfig {
25
icon: IconName;
26
name: string;
27
descr: ReactNode;
28
details: ReactNode;
29
cpu: number;
30
ram: number;
31
disk: number;
32
uptime: Uptime;
33
member: boolean;
34
expect: string[];
35
note?: ReactNode;
36
}
37
38
type PresetEntries = {
39
[key in Preset]: PresetConfig;
40
};
41
42
// some constants to keep text and preset in sync
43
const STANDARD_CPU = 1;
44
const STANDARD_RAM = 4;
45
const STANDARD_DISK = 3;
46
47
const PRESET_STANDARD_NAME = "Standard";
48
49
export const PRESETS: PresetEntries = {
50
standard: {
51
icon: "line-chart",
52
name: PRESET_STANDARD_NAME,
53
descr:
54
"is a good choice for most users to get started and students in a course",
55
expect: [
56
"Run 5-10 Jupyter Notebooks at once,",
57
"Edit LaTeX, Markdown, R Documents, and use VS Code,",
58
`${STANDARD_DISK} GB disk space is sufficient to store many files and small datasets.`,
59
],
60
note: (
61
<Paragraph type="secondary">
62
You can start with a "Run Limit" of one project. Later, when your usage
63
increases, you can easily edit your license at any time to change the
64
"Run Limit" or the quotas. Read more about{" "}
65
<A href={"https://doc.cocalc.com/licenses.html"}>Managing Licenses</A>{" "}
66
in our documentation.
67
</Paragraph>
68
),
69
details: (
70
<>
71
You can run 5-10 Jupyter Notebooks in a project at once, depending on
72
the kernel and memory usage. This quota is fine for editing LaTeX
73
documents, working with Sage Worksheets, using VS Code, and editing all
74
other document types. Also, {STANDARD_DISK} GB of disk space is
75
sufficient to store many files and a few small datasets.
76
</>
77
),
78
cpu: STANDARD_CPU,
79
ram: STANDARD_RAM,
80
disk: STANDARD_DISK,
81
uptime: "short",
82
member: true,
83
},
84
instructor: {
85
icon: "slides",
86
name: "Instructor",
87
descr: "is good for your instructor project when teaching a course",
88
expect: [
89
"Grade the work of students,",
90
"Run 10-20 Jupyter Notebooks at once¹,",
91
"Store the files of all students,",
92
"Make longer breaks without your project being shut down.",
93
],
94
note: (
95
<>
96
<Paragraph type="secondary">
97
For your instructor project, you only need one such license with a
98
"Run Limit" of 1. Apply that license via the{" "}
99
<A href={"https://doc.cocalc.com/project-settings.html#licenses"}>
100
project settings
101
</A>
102
. For the students, select a "{PRESET_STANDARD_NAME}" license with a
103
"Run Limit" of the number of students and distribute it via the{" "}
104
<A
105
href={
106
"https://doc.cocalc.com/teaching-upgrade-course.html#teacher-or-institute-pays-for-upgrades"
107
}
108
>
109
course configuration
110
</A>
111
.
112
</Paragraph>
113
<Paragraph type="secondary">
114
¹ Depends on the kernel; also, make sure to use the{" "}
115
<A
116
href={
117
"https://doc.cocalc.com/jupyter.html?highlight=halt%20button#use-the-halt-button-to-conserve-memory"
118
}
119
>
120
Halt button
121
</A>
122
.
123
</Paragraph>
124
</>
125
),
126
details: (
127
<>
128
The upgrade schema is suitable for grading the work of students: by
129
increasing the memory quota you can run many Jupyter Notebooks at the
130
same time – still, make sure to use the{" "}
131
<A
132
href={
133
"https://doc.cocalc.com/jupyter.html?highlight=halt%20button#use-the-halt-button-to-conserve-memory"
134
}
135
>
136
Halt button
137
</A>{" "}
138
to avoid exceeding the quota. Regarding disk space, distributing and
139
collecting files from many students adds up – hence the disk quota is
140
increased significantly! Finally, a longer idle-timeout will allow you
141
to make longer breaks without your project being shut down. You only
142
need a license with a "Run Limit" of one for your instructor project.
143
Apply that license via the{" "}
144
<A href={"https://doc.cocalc.com/project-settings.html#licenses"}>
145
project settings
146
</A>
147
, not the course configuration!
148
</>
149
),
150
cpu: 1,
151
ram: 2 * STANDARD_RAM,
152
disk: 15,
153
uptime: "medium",
154
member: true,
155
},
156
research: {
157
icon: "users",
158
name: "Researcher",
159
descr:
160
"is a good choice for intense professional usage or a research group",
161
expect: [
162
"Run many Jupyter Notebooks at once,",
163
"Run memory-intensive computations,",
164
"1 day idle-timeout is sufficient to not interrupt your work, and to execute long-running calculations.",
165
"More disk space also allows you to store larger datasets.",
166
],
167
note: (
168
<>
169
<Paragraph type="secondary">
170
If you need{" "}
171
<b>much more dedicated disk space, a GPU, more CPU or RAM</b>, you
172
should also{" "}
173
<b>
174
use <A href="/features/compute-server">compute servers</A>.
175
</b>
176
</Paragraph>
177
</>
178
),
179
details: (
180
<>
181
This configuration allows the project to run many Jupyter Notebooks at
182
once and run memory-intensive computations. An idle-timeout of one day
183
is sufficient to not interrupt your work; you can also execute
184
long-running calculations with this configuration. Increasing the disk
185
space quota also allows you to store larger datasets. If you need{" "}
186
<b>much more dedicated disk space, a GPU, more CPU or RAM</b>, you
187
should also{" "}
188
<b>
189
use a <A href="/features/compute-server">compute server</A>.
190
</b>
191
</>
192
),
193
cpu: 2,
194
ram: 10,
195
disk: 10,
196
uptime: "day",
197
member: true,
198
},
199
} as const;
200
201