Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jsun-m committed Oct 31, 2024
1 parent 939fa86 commit 9487d45
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions pkg/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,14 @@ func filterWorkersByResources(workers []*types.Worker, request *types.ContainerR
filteredWorkers := []*types.Worker{}
gpuRequestsMap := map[string]int{}
requiresGPU := request.RequiresGPU()
requiresAnyGPU := false

for index, gpu := range request.GpuRequest {
gpuRequestsMap[gpu] = index
if gpu == types.ANY_GPU.String() {
requiresAnyGPU = true
break
}
}

for _, worker := range workers {
Expand All @@ -309,22 +314,11 @@ func filterWorkersByResources(workers []*types.Worker, request *types.ContainerR
continue
}

if requiresGPU {
if requiresGPU && !requiresAnyGPU {
// Validate GPU resource availability

priorityModifier, validGpu := gpuRequestsMap[worker.Gpu]
if !validGpu {
// If the worker does not have the requested GPU, check if request has ANY as a gpu option
anyGpuIndex, ok := gpuRequestsMap[types.ANY_GPU.String()]
if !ok {
continue
}

// We still want to keep the priority order of ANY in the gpu request
priorityModifier = anyGpuIndex
}

if worker.FreeGpuCount < request.GpuCount {
if !validGpu || worker.FreeGpuCount < request.GpuCount {
continue
}

Expand Down

0 comments on commit 9487d45

Please sign in to comment.