Skip to content

Commit

Permalink
Add more scheduler logging for pods
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis committed Jan 31, 2025
1 parent bb27849 commit 30f58ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions pkg/controllers/provisioning/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ func (p *Provisioner) Schedule(ctx context.Context) (scheduler.Results, error) {
if len(pods) == 0 {
return scheduler.Results{}, nil
}
log.FromContext(ctx).V(1).WithValues("pending-pods", len(pendingPods), "deleting-pods", len(deletingNodePods)).Info("computing scheduling decision for provisionable pod(s)")
s, err := p.NewScheduler(ctx, pods, nodes.Active())
if err != nil {
if errors.Is(err, ErrNodePoolsNotFound) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/provisioning/scheduling/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (r Results) Record(ctx context.Context, recorder events.Recorder, cluster *
if existingCount == 0 {
return
}
log.FromContext(ctx).Info(fmt.Sprintf("computed %d unready node(s) will fit %d pod(s)", inflightCount, existingCount))
log.FromContext(ctx).WithValues("nodes", inflightCount, "pods", existingCount).Info(fmt.Sprintf("computed unready node(s) will fit pod(s)"))
}

// AllNonPendingPodsScheduled returns true if all pods scheduled.
Expand Down Expand Up @@ -229,7 +229,7 @@ func (s *Scheduler) Solve(ctx context.Context, pods []*corev1.Pod) Results {
QueueDepth.Set(float64(len(q.pods)), map[string]string{ControllerLabel: injection.GetControllerName(ctx), schedulingIDLabel: string(s.id)})

if s.clock.Since(lastLogTime) > time.Minute {
log.FromContext(ctx).WithValues("pods-scheduled", batchSize-len(q.pods), "pods-remaining", len(q.pods), "duration", s.clock.Since(startTime).Truncate(time.Second), "scheduling-id", string(s.id)).Info("computing pod scheduling...")
log.FromContext(ctx).WithValues("pods-scheduled", batchSize-len(q.pods), "pods-remaining", len(q.pods), "existing-nodes", len(s.existingNodes), "simulated-nodes", len(s.newNodeClaims), "duration", s.clock.Since(startTime).Truncate(time.Second), "scheduling-id", string(s.id)).Info("computing pod scheduling...")
lastLogTime = s.clock.Now()
}
// Try the next pod
Expand Down

0 comments on commit 30f58ba

Please sign in to comment.