Skip to content

Commit

Permalink
address comments from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross committed Dec 18, 2024
1 parent bbd1e22 commit 99e5318
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions scheduler/feasible.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,16 @@ func (h *HostVolumeChecker) hostVolumeIsAvailable(
// examine all proposed allocs on the node, including those that might
// not have yet been persisted. they have nil pointers to their Job, so
// we have to go back to the state store to get them
seen := map[structs.NamespacedID]struct{}{}
seen := map[string]struct{}{}
for _, alloc := range proposed {
if _, ok := seen[alloc.JobNamespacedID()]; ok {
// all allocs for the same job will have the same read-only flag
// and capabilities, so we only need to check a given job once
uniqueGroup := alloc.JobNamespacedID().String() + alloc.TaskGroup
if _, ok := seen[uniqueGroup]; ok {
// all allocs for the same group will have the same read-only
// flag and capabilities, so we only need to check a given group
// once
continue
}
seen[alloc.JobNamespacedID()] = struct{}{}
seen[uniqueGroup] = struct{}{}
job, err := h.ctx.State().JobByID(nil, alloc.Namespace, alloc.JobID)
if err != nil {
return false
Expand Down
2 changes: 1 addition & 1 deletion scheduler/feasible_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ func TestHostVolumeChecker_Sticky(t *testing.T) {
}

// TestDynamicHostVolumeIsAvailable provides fine-grained coverage of the
// dynamicHostVolumeIsAvailable function
// hostVolumeIsAvailable method
func TestDynamicHostVolumeIsAvailable(t *testing.T) {

store, ctx := testContext(t)
Expand Down

0 comments on commit 99e5318

Please sign in to comment.