Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jsun-m committed Jan 3, 2025
1 parent c9fb429 commit 574bf28
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions pkg/worker/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ func (w *Worker) collectAndSendContainerMetrics(ctx context.Context, request *ty
ticker := time.NewTicker(w.config.Monitoring.ContainerMetricsInterval)
defer ticker.Stop()

gpuDeviceIds, _ := w.containerCudaManager.GetContainerGPUDevices(request.ContainerId)
monitor := NewProcessMonitor(containerPid, spec.Linux.Resources.Devices, gpuDeviceIds)
monitor := NewProcessMonitor(containerPid, spec.Linux.Resources.Devices, w.containerCudaManager.GetContainerGPUDevices(request.ContainerId))

for {
select {
Expand Down
8 changes: 4 additions & 4 deletions pkg/worker/nvidia.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (

type GPUManager interface {
AssignGPUDevices(containerId string, gpuCount uint32) (*AssignedGpuDevices, error)
GetContainerGPUDevices(containerId string) ([]int, bool)
GetContainerGPUDevices(containerId string) []int
UnassignGPUDevices(containerId string)
InjectEnvVars(env []string, options *ContainerOptions) ([]string, bool)
InjectMounts(mounts []specs.Mount) []specs.Mount
Expand Down Expand Up @@ -121,13 +121,13 @@ func (c *ContainerNvidiaManager) AssignGPUDevices(containerId string, gpuCount u
}, nil
}

func (c *ContainerNvidiaManager) GetContainerGPUDevices(containerId string) ([]int, bool) {
func (c *ContainerNvidiaManager) GetContainerGPUDevices(containerId string) []int {
gpuDevices, ok := c.gpuAllocationMap.Get(containerId)
if !ok {
return []int{}, false
return []int{}
}

return gpuDevices, true
return gpuDevices
}

func (c *ContainerNvidiaManager) chooseDevices(containerId string, requestedGpuCount uint32) ([]int, error) {
Expand Down

0 comments on commit 574bf28

Please sign in to comment.