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

Function apply_gpu_limit

crates/openshell-driver-kubernetes/src/driver.rs:1933–1948  ·  view source on GitHub ↗
(resources: &mut serde_json::Value, quantity: &str)

Source from the content-addressed store, hash-verified

1931}
1932
1933fn apply_gpu_limit(resources: &mut serde_json::Value, quantity: &str) {
1934 let Some(resources_obj) = resources.as_object_mut() else {
1935 *resources = serde_json::json!({});
1936 return apply_gpu_limit(resources, quantity);
1937 };
1938
1939 let limits = resources_obj
1940 .entry("limits")
1941 .or_insert_with(|| serde_json::json!({}));
1942 let Some(limits_obj) = limits.as_object_mut() else {
1943 *limits = serde_json::json!({});
1944 return apply_gpu_limit(resources, quantity);
1945 };
1946
1947 limits_obj.insert(GPU_RESOURCE_NAME.to_string(), serde_json::json!(quantity));
1948}
1949
1950#[allow(clippy::too_many_arguments)]
1951fn build_env_list(

Callers 1

container_resourcesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected