Skip to content
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
3 changes: 2 additions & 1 deletion runner/internal/shim/api/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"net/http"
"reflect"

"github.com/dstackai/dstack/runner/internal/api"
"github.com/dstackai/dstack/runner/internal/log"
Expand All @@ -24,7 +25,7 @@ func (s *ShimServer) HealthcheckHandler(w http.ResponseWriter, r *http.Request)
func (s *ShimServer) InstanceHealthHandler(w http.ResponseWriter, r *http.Request) (interface{}, error) {
ctx := r.Context()
response := InstanceHealthResponse{}
if s.dcgmWrapper != nil {
if !reflect.ValueOf(s.dcgmWrapper).IsNil() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should work, but I suppose if implementation changes so that dcgmWrapper is a struct and not a struct pointer, this will panic?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently, yes. But we specifically use a pointer to distinguish between cases when DCGM is available and when it's not, it's unlikely that we will change this.

if dcgmHealth, err := s.dcgmWrapper.GetHealth(); err != nil {
log.Error(ctx, "failed to get health from DCGM", "err", err)
} else {
Expand Down
Loading