Skip to content

Commit

Permalink
fallback to pidof
Browse files Browse the repository at this point in the history
Signed-off-by: Gyuho Lee <[email protected]>
  • Loading branch information
gyuho committed Dec 24, 2024
1 parent c5fd9c6 commit c39fd4e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion components/accelerator/nvidia/query/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/leptonai/gpud/components/systemd"
"github.com/leptonai/gpud/log"
"github.com/leptonai/gpud/pkg/process"
pkg_systemd "github.com/leptonai/gpud/pkg/systemd"

go_nvml "github.com/NVIDIA/go-nvml/pkg/nvml"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -101,8 +102,14 @@ func Get(ctx context.Context, db *sql.DB) (output any, err error) {
}

cctx, ccancel := context.WithTimeout(ctx, 15*time.Second)

Check failure on line 104 in components/accelerator/nvidia/query/query.go

View workflow job for this annotation

GitHub Actions / golangci-lint

ineffectual assignment to cctx (ineffassign)
pdRunning := process.CheckRunningByPid(cctx, "nvidia-persistenced")
pdRunning, err := pkg_systemd.IsActive("nvidia-persistenced")
ccancel()
if err != nil {
log.Logger.Debugw("failed to check nvidia-persistenced systemd service -- falling back to pid check", "error", err)
cctx, ccancel = context.WithTimeout(ctx, 15*time.Second)
pdRunning = process.CheckRunningByPid(cctx, "nvidia-persistenced")
ccancel()
}

o := &Output{
SMIExists: SMIExists(),
Expand Down

0 comments on commit c39fd4e

Please sign in to comment.