the scheduler checks whether task changes require a restart, this needed

to be updated to consider devices
This commit is contained in:
Chris Baker 2019-11-07 17:51:15 +00:00
parent 2638cbb31d
commit 95ae01a9f4
2 changed files with 20 additions and 0 deletions

View File

@ -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

View File

@ -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) {
t.Fatalf("bad")
}
j12 := mock.Job()
j12.TaskGroups[0].Tasks[0].Resources.Networks[0].MBits = 100
if !tasksUpdated(j1, j12, name) {