MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / has_gpu_capacity

Method has_gpu_capacity

crates/openshell-driver-kubernetes/src/driver.rs:408–417  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

406 }
407
408 async fn has_gpu_capacity(&self) -> Result<bool, KubeError> {
409 let nodes: Api<Node> = Api::all(self.client.clone());
410 let node_list = nodes.list(&ListParams::default()).await?;
411 Ok(node_list.items.into_iter().any(|node| {
412 node.status
413 .and_then(|status| status.allocatable)
414 .and_then(|allocatable| allocatable.get(GPU_RESOURCE_NAME).cloned())
415 .is_some_and(|quantity| quantity.0 != "0")
416 }))
417 }
418
419 pub async fn validate_sandbox_create(&self, sandbox: &Sandbox) -> Result<(), tonic::Status> {
420 let _ = KubernetesSandboxDriverConfig::from_sandbox(sandbox)

Callers 1

Calls 2

listMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected