Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider devices in tasksUpdated #6647

Merged
merged 4 commits into from
Nov 7, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ IMPROVEMENTS:
BUG FIXES:

* cli: Make scoring column orders consistent `nomad alloc status` [[GH-6609](https://github.com/hashicorp/nomad/issues/6609)]
* server: Changes to devices in resource stanza should cause rescheduling [[GH-6644](https://github.com/hashicorp/nomad/issues/6644)]
cgbaker marked this conversation as resolved.
Show resolved Hide resolved

## 0.10.1 (November 4, 2019)

Expand Down
2 changes: 2 additions & 0 deletions scheduler/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ func tasksUpdated(jobA, jobB *structs.Job, taskGroup string) bool {
return true
} else if ar.MemoryMB != br.MemoryMB {
return true
} else if !ar.Devices.Equals(&br.Devices) {
return true
}
}
return false
Expand Down
18 changes: 18 additions & 0 deletions scheduler/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,24 @@ func TestTasksUpdated(t *testing.T) {
t.Fatalf("bad")
}

j11d1 := mock.Job()
j11d1.TaskGroups[0].Tasks[0].Resources.Devices = structs.ResourceDevices{
&structs.RequestedDevice{
Name: "gpu",
Count: 1,
},
}
j11d2 := mock.Job()
j11d2.TaskGroups[0].Tasks[0].Resources.Devices = structs.ResourceDevices{
&structs.RequestedDevice{
Name: "gpu",
Count: 2,
},
}
if !tasksUpdated(j11d1, j11d2, name) {
cgbaker marked this conversation as resolved.
Show resolved Hide resolved
t.Fatalf("bad")
}

j12 := mock.Job()
j12.TaskGroups[0].Tasks[0].Resources.Networks[0].MBits = 100
if !tasksUpdated(j1, j12, name) {
Expand Down