Skip to content

Commit

Permalink
wip: remove netlog
Browse files Browse the repository at this point in the history
  • Loading branch information
shoenig committed Aug 21, 2024
1 parent 5026ab9 commit d4ba99e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 191 deletions.
5 changes: 0 additions & 5 deletions go.work

This file was deleted.

175 changes: 0 additions & 175 deletions go.work.sum

This file was deleted.

7 changes: 0 additions & 7 deletions nvml/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"cmp"
"fmt"
"slices"

"github.com/shoenig/netlog"
)

// DeviceData represents common fields for Nvidia device
Expand Down Expand Up @@ -81,8 +79,6 @@ func NewNvmlClient() (*nvmlClient, error) {
}, nil
}

var nl = netlog.New("nvml")

// GetFingerprintData returns FingerprintData for available Nvidia devices
func (c *nvmlClient) GetFingerprintData() (*FingerprintData, error) {
/*
Expand Down Expand Up @@ -117,8 +113,6 @@ func (c *nvmlClient) GetFingerprintData() (*FingerprintData, error) {
allNvidiaGPUResources := make([]*FingerprintDeviceData, 0, len(deviceUUIDs))

for uuid, mode := range deviceUUIDs {
nl.Info("GFP", "uuid", uuid, "mode", mode)

// do not care about phsyical parents of MIGs
if mode == parent {
continue
Expand Down Expand Up @@ -197,7 +191,6 @@ func (c *nvmlClient) GetStatsData() ([]*StatsData, error) {

deviceInfo, deviceStatus, err := c.driver.DeviceInfoAndStatusByUUID(uuid)
if err != nil {
nl.Error("A DeviceInfoAndStatusByUUID failed", "uuid", uuid, "mode", mode)
return nil, fmt.Errorf("nvidia nvml DeviceInfoAndStatusByUUID() error: %v\n", err)
}

Expand Down
10 changes: 6 additions & 4 deletions nvml/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"github.com/shoenig/test/must"
)

var _ NvmlDriver = (*MockNVMLDriver)(nil)

type MockNVMLDriver struct {
systemDriverCallSuccessful bool
listDeviceUUIDsSuccessful bool
Expand All @@ -36,15 +38,15 @@ func (m *MockNVMLDriver) SystemDriverVersion() (string, error) {
return m.driverVersion, nil
}

func (m *MockNVMLDriver) ListDeviceUUIDs() ([]string, error) {
func (m *MockNVMLDriver) ListDeviceUUIDs() (map[string]mode, error) {
if !m.listDeviceUUIDsSuccessful {
return nil, errors.New("failed to get device length")
}

allNvidiaGPUUUIDs := make([]string, len(m.devices))
allNvidiaGPUUUIDs := make(map[string]mode)

for i, device := range m.devices {
allNvidiaGPUUUIDs[i] = device.UUID
for _, device := range m.devices {
allNvidiaGPUUUIDs[device.UUID] = normal
}

return allNvidiaGPUUUIDs, nil
Expand Down

0 comments on commit d4ba99e

Please sign in to comment.