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