MCPcopy Index your code
hub / github.com/cortexlabs/cortex / nodeComputeAllocatable

Function nodeComputeAllocatable

pkg/operator/endpoints/info.go:176–186  ·  view source on GitHub ↗
(node *kcore.Node)

Source from the content-addressed store, hash-verified

174}
175
176func nodeComputeAllocatable(node *kcore.Node) userconfig.Compute {
177 gpuQty := node.Status.Allocatable["nvidia.com/gpu"]
178 infQty := node.Status.Allocatable["aws.amazon.com/neuron"]
179
180 return userconfig.Compute{
181 CPU: k8s.WrapQuantity(*node.Status.Allocatable.Cpu()),
182 Mem: k8s.WrapQuantity(*node.Status.Allocatable.Memory()),
183 GPU: gpuQty.Value(),
184 Inf: infQty.Value(),
185 }
186}
187
188func getOperatorNodeInfos() ([]schema.NodeInfo, error) {
189 nodes, err := config.K8sAllNamspaces.ListNodesByLabel("operator", "true")

Callers 1

getWorkerNodeInfosFunction · 0.85

Calls 1

WrapQuantityFunction · 0.92

Tested by

no test coverage detected