Skip to content

Commit e7af5c5

Browse files
committed
solve bug for workloads default utilization
1 parent 503ed80 commit e7af5c5

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

internal/status-updater/handlers/pod/gpu_usage_calculator.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func calculateGpuUsageFromPodType(dynamicclient dynamic.Interface, pod *v1.Pod,
7171
switch podType {
7272
case "train":
7373
return generateGpuUsageStatus(topology.Range{Min: 80, Max: 100}, gpuFraction, totalGpuMemory, false)
74-
case "build", "interactive-preemptible":
74+
case "build", "interactive-preemptible", "interactive", "distributed":
7575
return generateGpuUsageStatus(topology.Range{Min: 0, Max: 0}, gpuFraction, totalGpuMemory, false)
7676
case "inference":
7777
return generateGpuUsageStatus(topology.Range{Min: 0, Max: 0}, gpuFraction, totalGpuMemory, true)
@@ -104,6 +104,22 @@ func calculateUtilizationFromAnnotation(annotationValue string) (*topology.Range
104104
}
105105

106106
func getPodType(dynamicClient dynamic.Interface, pod *v1.Pod) (string, error) {
107+
// First, try to get workload type from pod labels
108+
if workloadKind, ok := pod.Labels["workloadKind"]; ok {
109+
// Map Run:AI workload kinds to utilization types
110+
switch workloadKind {
111+
case "TrainingWorkload":
112+
return "train", nil
113+
case "DistributedWorkload":
114+
return "distributed", nil
115+
case "InferenceWorkload":
116+
return "inference", nil
117+
case "InteractiveWorkload":
118+
return "interactive", nil
119+
}
120+
}
121+
122+
// Fallback to existing PodGroup lookup
107123
podGroupName := pod.Annotations[constants.AnnotationPodGroupName]
108124
if podGroupName == "" {
109125
return "", fmt.Errorf("pod %s has no constants.PodGroupNameAnnotation annotation", pod.Name)

0 commit comments

Comments
 (0)