Skip to content

Commit 2bd17e3

Browse files
committed
CoPilot fixes
1 parent ebb3385 commit 2bd17e3

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

pkg/observability/tracing_integration.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,14 @@ func (tgs *TracedGPUScheduler) Schedule(ctx context.Context) error {
9696

9797
// Get queue information before scheduling
9898
metrics := tgs.scheduler.GetUtilizationMetrics()
99-
queueSize := metrics["pending_workloads"].(int)
100-
totalGPUs := metrics["total_gpus"].(int)
99+
queueSize, ok := metrics["pending_workloads"].(int)
100+
if !ok {
101+
queueSize = 0
102+
}
103+
totalGPUs, ok := metrics["total_gpus"].(int)
104+
if !ok {
105+
totalGPUs = 0
106+
}
101107

102108
tgs.tracer.AddSpanAttributes(span,
103109
attribute.Int("scheduler.queue_size", queueSize),
@@ -110,7 +116,10 @@ func (tgs *TracedGPUScheduler) Schedule(ctx context.Context) error {
110116

111117
// Get scheduling results
112118
metricsAfter := tgs.scheduler.GetUtilizationMetrics()
113-
queueSizeAfter := metricsAfter["pending_workloads"].(int)
119+
queueSizeAfter, ok := metricsAfter["pending_workloads"].(int)
120+
if !ok {
121+
queueSizeAfter = 0
122+
}
114123
scheduledCount := queueSize - queueSizeAfter
115124

116125
tgs.tracer.AddSpanAttributes(span,

0 commit comments

Comments
 (0)