Skip to content

Commit

Permalink
Linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gjulianm committed Jan 8, 2025
1 parent 47fac74 commit aa84a91
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion comp/core/workloadmeta/collectors/internal/nvml/nvml.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func GetFxOptions() fx.Option {
return fx.Provide(NewCollector)
}

// Start initializes the NVML library and sets the store
func (c *collector) Start(_ context.Context, store workloadmeta.Component) error {
if !env.IsFeaturePresent(env.NVML) {
return errors.NewDisabled(componentName, "Agent does not have NVML library available")
Expand All @@ -64,7 +65,8 @@ func (c *collector) Start(_ context.Context, store workloadmeta.Component) error
return nil
}

func (c *collector) Pull(ctx context.Context) error {
// Pull collects the GPUs available on the node and notifies the store
func (c *collector) Pull(_ context.Context) error {
count, ret := c.nvmlLib.DeviceGetCount()
if ret != nvml.SUCCESS {
return fmt.Errorf("failed to get device count: %v", nvml.ErrorString(ret))
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/env/environment_containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func detectContainerFeatures(features FeatureMap, cfg model.Reader) {
detectCloudFoundry(features, cfg)
detectPodman(features, cfg)
detectPodResources(features, cfg)
detectNVML(features, cfg)
detectNVML(features)
}

func detectKubernetes(features FeatureMap, cfg model.Reader) {
Expand Down Expand Up @@ -247,7 +247,7 @@ func detectPodResources(features FeatureMap, cfg model.Reader) {
}
}

func detectNVML(features FeatureMap, cfg model.Reader) {
func detectNVML(features FeatureMap) {
// TODO: Add configuration option for NVML library path
nvmlLib := nvml.New()
ret := nvmlLib.Init()
Expand Down
1 change: 1 addition & 0 deletions pkg/gpu/testutil/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ var GPUCores = []int{DefaultGpuCores, 20, 30, 40, 50, 60, 70}
// DefaultGpuUUID is the UUID for the default device returned by the mock
var DefaultGpuUUID = GPUUUIDs[0]

// DefaultGPUName is the name for the default device returned by the mock
var DefaultGPUName = "Tesla T4"

// GetDeviceMock returns a mock of the nvml.Device with the given UUID.
Expand Down

0 comments on commit aa84a91

Please sign in to comment.