Path: blob/master/src/packages/next/components/store/quota-config-presets.tsx
6115 views
/*1* This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { ReactNode } from "react";67import type { IconName } from "@cocalc/frontend/components/icon";89import { Uptime } from "@cocalc/util/consts/site-license";10import { MAX_DISK_GB } from "@cocalc/util/upgrades/consts";11import { Paragraph } from "components/misc";12import A from "components/misc/A";13import { STANDARD_DISK } from "@cocalc/util/consts/billing";1415export type Preset = "standard" | "instructor" | "research";1617// Fields to be used to match a configured license against a pre-existing preset.18//19export const PRESET_MATCH_FIELDS: Record<string, string> = {20cpu: "CPU count",21disk: "disk space",22ram: "memory",23uptime: "idle timeout",24member: "member hosting",25} as const;2627export interface PresetConfig {28icon: IconName;29name: string;30descr: ReactNode;31details: ReactNode;32cpu: number;33ram: number;34disk: number;35uptime: Uptime;36member: boolean;37expect: string[];38note?: ReactNode;39}4041type PresetEntries = {42[key in Preset]: PresetConfig;43};4445// some constants to keep text and preset in sync46const STANDARD_CPU = 1;47const STANDARD_RAM = 4;4849const PRESET_STANDARD_NAME = "Standard";5051export const SITE_LICENSE: PresetEntries = {52standard: {53icon: "line-chart",54name: PRESET_STANDARD_NAME,55descr:56"is a good choice for most users to get started and students in a course",57expect: [58"Run 5-10 Jupyter Notebooks at once,",59"Edit LaTeX, Markdown, R Documents, and use VS Code,",60`${STANDARD_DISK} GB disk space is sufficient to store many files and small datasets.`,61],62note: (63<Paragraph type="secondary">64You can start with a "Run Limit" of one project. Later, when your usage65increases, you can easily edit your license at any time to change the66"Run Limit" or the quotas. Read more about{" "}67<A href={"https://doc.cocalc.com/licenses.html"}>Managing Licenses</A>{" "}68in our documentation.69</Paragraph>70),71details: (72<>73You can run 5-10 Jupyter Notebooks in a project at once, depending on74the kernel and memory usage. This quota is fine for editing LaTeX75documents, working with Sage Worksheets, using VS Code, and editing all76other document types. Also, {STANDARD_DISK} GB of disk space is77sufficient to store many files and a few small datasets.78</>79),80cpu: STANDARD_CPU,81ram: STANDARD_RAM,82disk: STANDARD_DISK,83uptime: "short",84member: true,85},86instructor: {87icon: "slides",88name: "Instructor",89descr: "is good for your instructor project when teaching a course",90expect: [91"Grade the work of students,",92"Run 10-20 Jupyter Notebooks at once¹,",93"Store the files of all students,",94"Make longer breaks without your project being shut down.",95],96note: (97<>98<Paragraph type="secondary">99For your instructor project, you only need one such license with a100"Run Limit" of 1. Apply that license via the{" "}101<A href={"https://doc.cocalc.com/project-settings.html#licenses"}>102project settings103</A>104. For the students, select a "{PRESET_STANDARD_NAME}" license with a105"Run Limit" of the number of students and distribute it via the{" "}106<A107href={108"https://doc.cocalc.com/teaching-upgrade-course.html#teacher-or-institute-pays-for-upgrades"109}110>111course configuration112</A>113.114</Paragraph>115<Paragraph type="secondary">116¹ Depends on the kernel; also, make sure to use the{" "}117<A118href={119"https://doc.cocalc.com/jupyter.html?highlight=halt%20button#use-the-halt-button-to-conserve-memory"120}121>122Halt button123</A>124.125</Paragraph>126</>127),128details: (129<>130The upgrade schema is suitable for grading the work of students: by131increasing the memory quota you can run many Jupyter Notebooks at the132same time – still, make sure to use the{" "}133<A134href={135"https://doc.cocalc.com/jupyter.html?highlight=halt%20button#use-the-halt-button-to-conserve-memory"136}137>138Halt button139</A>{" "}140to avoid exceeding the quota. Regarding disk space, distributing and141collecting files from many students adds up – hence the disk quota is142increased significantly! Finally, a longer idle-timeout will allow you143to make longer breaks without your project being shut down. You only144need a license with a "Run Limit" of one for your instructor project.145Apply that license via the{" "}146<A href={"https://doc.cocalc.com/project-settings.html#licenses"}>147project settings148</A>149, not the course configuration!150</>151),152cpu: 1,153ram: 2 * STANDARD_RAM,154disk: Math.min(Math.max(15, 4 * STANDARD_DISK), MAX_DISK_GB),155uptime: "medium",156member: true,157},158research: {159icon: "users",160name: "Researcher",161descr:162"is a good choice for intense professional usage or a research group",163expect: [164"Run many Jupyter Notebooks at once,",165"Run memory-intensive computations,",166"1 day idle-timeout is sufficient to not interrupt your work, and to execute long-running calculations.",167"More disk space also allows you to store larger datasets.",168],169note: (170<>171<Paragraph type="secondary">172If you need{" "}173<b>much more dedicated disk space, a GPU, more CPU or RAM</b>, you174should also{" "}175<b>176use <A href="/features/compute-server">compute servers</A>.177</b>178</Paragraph>179</>180),181details: (182<>183This configuration allows the project to run many Jupyter Notebooks at184once and run memory-intensive computations. An idle-timeout of one day185is sufficient to not interrupt your work; you can also execute186long-running calculations with this configuration. Increasing the disk187space quota also allows you to store larger datasets. If you need{" "}188<b>much more dedicated disk space, a GPU, more CPU or RAM</b>, you189should also{" "}190<b>191use a <A href="/features/compute-server">compute server</A>.192</b>193</>194),195cpu: 2,196ram: 2 * STANDARD_RAM,197disk: Math.min(Math.max(15, 4 * STANDARD_DISK), MAX_DISK_GB),198uptime: "day",199member: true,200},201} as const;202203export const COURSE = {204standard: {205icon: "line-chart",206name: PRESET_STANDARD_NAME,207descr: "is a good choice for most use cases in a course",208expect: [209"Run a couple of Jupyter Notebooks at once,",210"Edit LaTeX, Markdown, R Documents, and use VS Code,",211`${STANDARD_DISK} GB disk space is sufficient to store many files and small datasets.`,212],213note: <>Suitable for most courses.</>,214details: (215<>216You can run a couple of Jupyter Notebooks in a project at once,217depending on the kernel and memory usage. This quota is fine for editing218LaTeX documents, working with Sage Worksheets, using VS Code, and219editing all other document types. Also, {STANDARD_DISK} GB of disk space220is sufficient to store many files and a few small datasets.221</>222),223cpu: STANDARD_CPU,224ram: STANDARD_RAM,225disk: STANDARD_DISK,226uptime: "short",227member: true,228},229advanced: {230icon: "rocket",231name: "Advanced",232descr: "provides higher quotas for more intensive course work",233expect: [234"Run more Jupyter Notebooks simultaneously,",235"Handle memory-intensive computations,",236"Longer idle timeout for extended work sessions,",237"Sufficient resources for advanced coursework.",238],239note: <>For intense computations requiring more resources.</>,240details: (241<>242This configuration provides enhanced resources for more demanding243coursework. With 1 CPU, 8GB RAM, and a 2-hour idle timeout, students can244work on memory-intensive projects and longer computational tasks without245interruption. Ideal for advanced programming, data science, and246research-oriented courses.247</>248),249cpu: 1,250ram: 8,251disk: Math.min(2 * STANDARD_DISK, MAX_DISK_GB),252uptime: "medium",253member: true,254},255} as const satisfies { [key in "standard" | "advanced"]: PresetConfig };256257258