Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify log formatting and add new log messages #17

Merged
merged 2 commits into from
Mar 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions pkg/watcher/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,20 +212,27 @@ func isNodeReady(node *corev1.Node) bool {

func isNodeDesiredGPU(node *corev1.Node, desired int) bool {
if desired == 0 {
slog.Info("desired gpu count is set to 0", "node", node.GetName())
slog.Info("Desired GPU count is set to 0", "node", node.GetName())
return true
}

quantity, exists := node.Status.Allocatable[gpuResourceName]
if !exists || quantity.IsZero() {
slog.Info("read allocatable gpus", "node", node.GetName(), "count", quantity.String())
slog.Info("Allocatable GPU not found", "node", node.GetName())
return false
}

gpuCount, ok := quantity.AsInt64()
if !ok {
slog.Info("Failed to convert allocatable GPU quantity to int64", "node", node.GetName(), "quantity", quantity.String())
return false
}

slog.Info("Checking actual GPU count with desired",
"node", node.GetName(),
"actual", gpuCount,
"desired", strconv.Itoa(desired))

return gpuCount == int64(desired)
}

Expand Down