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/pricing.ts
Views: 687
1
export interface PurchaseOption {
2
flavor_name: string;
3
// name of region that has this machine type
4
region_name: string;
5
// number of vCPUs
6
cpu: number;
7
// GB of ram
8
ram: number;
9
// GB of less ephemeral disk (?)
10
disk: number;
11
// GB of local ephemeral disk
12
ephemeral: number;
13
// string that describes the GPU
14
gpu: string;
15
// how many gpu's in this machine
16
gpu_count: number;
17
// number of these VM's that are currently available
18
available?: number;
19
// how much this option costs per hour, or a string with an error
20
// if we can't determine the cost
21
cost_per_hour: number | string;
22
}
23
24
export function optionKey({ region_name, flavor_name }) {
25
return `${region_name}|${flavor_name}`;
26
}
27
28
export interface HyperstackPriceData {
29
markup: number;
30
// region_bar_flavor is `${region_name}|${flavor_name}` as in optionKey function above!
31
options: { [region_bar_flavor: string]: PurchaseOption };
32
// cost per hour of an external ip address
33
external_ip_cost_per_hour: number;
34
// cost per hour per GB of disk storage (for storage volumes)
35
ssd_cost_per_hour: number;
36
}
37
38
export function markup({ cost, priceData }) {
39
if (priceData.markup) {
40
return cost * (1 + priceData.markup / 100.0);
41
}
42
return cost;
43
}
44
45