X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/0c9db5b63420bab25e970c75dfd9169b9c7db139..eb5b8638a308f7954f83a6a6659ae97d4f4e082d:/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx diff --git a/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx b/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx index 006a119797..2f240c8228 100644 --- a/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx +++ b/services/workbench2/src/views/instance-types-panel/instance-types-panel.tsx @@ -5,20 +5,26 @@ import React from 'react'; import { StyleRulesCallback, WithStyles, withStyles, Card, CardContent, Typography, Grid } from '@material-ui/core'; import { ArvadosTheme } from 'common/custom-theme'; -import { InstanceTypeIcon } from 'components/icon/icon'; +import { ResourceIcon } from 'components/icon/icon'; import { RootState } from 'store/store'; import { connect } from 'react-redux'; import { ClusterConfigJSON } from 'common/config'; import { NotFoundView } from 'views/not-found-panel/not-found-panel'; import { formatCWLResourceSize, formatCost, formatFileSize } from 'common/formatters'; +import { DetailsAttribute } from 'components/details-attribute/details-attribute'; +import { DefaultCodeSnippet } from 'components/default-code-snippet/default-code-snippet'; -type CssRules = 'root' | 'instanceType'; +type CssRules = 'root' | 'infoBox' | 'instanceType'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ root: { - width: '100%', + width: "calc(100% + 20px)", + margin: "0 -10px", overflow: 'auto' }, + infoBox: { + padding: "0 10px 10px", + }, instanceType: { padding: "10px", }, @@ -37,63 +43,106 @@ export const InstanceTypesPanel = withStyles(styles)(connect(mapStateToProps)( const instances = config.InstanceTypes || {}; - return - - - {Object.keys(instances).length > 0 ? - Object.keys(instances).map((instanceKey) => { - const instanceType = instances[instanceKey]; - const diskRequest = instanceType.IncludedScratch; - const ramRequest = instanceType.RAM - config.Containers.ReserveExtraRAM; + return + + + + + These are the cloud compute instance types + configured for this cluster. The core count and + maximum RAM request correspond to the greatest + values you can put in the CWL Workflow + ResourceRequest{" "} + {" "} + and{" "} + {" "} + and still be scheduled on that instance type. + + + + + {Object.keys(instances).length > 0 ? + Object.keys(instances) + .sort((a, b) => { + const typeA = instances[a]; + const typeB = instances[b]; + + if (typeA.Price !== typeB.Price) { + return typeA.Price - typeB.Price; + } else { + return typeA.ProviderType.localeCompare(typeB.ProviderType); + } + }).map((instanceKey) => { + const instanceType = instances[instanceKey]; + const maxDiskRequest = instanceType.IncludedScratch; + const keepBufferOverhead = calculateKeepBufferOverhead(instanceType.VCPUs); + const maxRamRequest = discountRamByPercent(instanceType.RAM - config.Containers.ReserveExtraRAM - keepBufferOverhead); - return - - - - {instanceKey} - - - Provider type: {instanceType.ProviderType} - - - Price: {formatCost(instanceType.Price)} - - - Cores: {instanceType.VCPUs} - - - Preemptible: {instanceType.Preemptible.toString()} - - - Max disk request: {formatCWLResourceSize(diskRequest)} ({formatFileSize(diskRequest)}) - - - Max RAM request: {formatCWLResourceSize(ramRequest)} ({formatFileSize(ramRequest)}) - - {instanceType.CUDA && instanceType.CUDA.DeviceCount > 0 ? - <> - - CUDA GPUs: {instanceType.CUDA.DeviceCount} - - - Hardware capability: {instanceType.CUDA.HardwareCapability} - - - Driver version: {instanceType.CUDA.DriverVersion} - - : <> - } - - - - }) : - - } - - - + return + + + + {instanceKey} + + + + + + + + + + + + + + + + + + + + {instanceType.CUDA && instanceType.CUDA.DeviceCount > 0 ? + <> + + + + + + + + + + : <> + } + + + ; + }) : + + } + ; } )); + +export const calculateKeepBufferOverhead = (coreCount: number): number => { + // TODO replace with exported server config + const buffersPerVCPU = 1; + + // Returns 220 MiB + 64MiB+10% per buffer + return (220 << 20) + (buffersPerVCPU * coreCount * (1 << 26) * (11/10)) +}; + +export const discountRamByPercent = (requestedRamBytes: number): number => { + // TODO replace this with exported server config or remove when no longer + // used by server in ram calculation + const discountPercent = 5; + + return requestedRamBytes * 100 / (100-discountPercent); +};