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/util/compute/cloud/hyperstack/flavor.ts
Views: 687
1
import { optionKey, HyperstackPriceData } from "./pricing";
2
3
// NOTE: keys here also assumed to be the flavors without a gpu below!
4
const HUMAN = {
5
s: "n1-cpu-extrasmall",
6
m: "n1-cpu-verysmall",
7
l: "n1-cpu-small",
8
xxl: "n1-cpu-large",
9
};
10
11
export function humanFlavor(flavor_name: string) {
12
return HUMAN[flavor_name] ?? flavor_name;
13
}
14
15
export function hasGPU(
16
configuration: { region_name: string; flavor_name: string },
17
priceData: HyperstackPriceData,
18
): boolean {
19
const key = optionKey(configuration);
20
const data = priceData.options[key];
21
return !!data?.gpu;
22
}
23
24
export function hasLocalSSD(
25
configuration: { region_name: string; flavor_name: string },
26
priceData: HyperstackPriceData,
27
): boolean {
28
const key = optionKey(configuration);
29
const data = priceData.options[key];
30
return !!data?.ephemeral;
31
}
32
33