mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 01:15:43 +03:00
scheduler: ignore allocations in terminal state
This commit is contained in:
@@ -211,6 +211,9 @@ func (s *GenericScheduler) computeJobAllocs() error {
|
||||
s.eval.JobID, err)
|
||||
}
|
||||
|
||||
// Filter out the allocations in a terminal state
|
||||
allocs = structs.FilterTerminalAllocs(allocs)
|
||||
|
||||
// Determine the tainted nodes containing job allocs
|
||||
tainted, err := taintedNodes(s.state, allocs)
|
||||
if err != nil {
|
||||
|
||||
@@ -139,6 +139,19 @@ func TestServiceSched_JobModify(t *testing.T) {
|
||||
}
|
||||
noErr(t, h.State.UpsertAllocs(h.NextIndex(), allocs))
|
||||
|
||||
// Add a few terminal status allocations, these should be ignored
|
||||
var terminal []*structs.Allocation
|
||||
for i := 0; i < 5; i++ {
|
||||
alloc := mock.Alloc()
|
||||
alloc.Job = job
|
||||
alloc.JobID = job.ID
|
||||
alloc.NodeID = nodes[i].ID
|
||||
alloc.Name = fmt.Sprintf("my-job.web[%d]", i)
|
||||
alloc.DesiredStatus = structs.AllocDesiredStatusFailed
|
||||
terminal = append(terminal, alloc)
|
||||
}
|
||||
noErr(t, h.State.UpsertAllocs(h.NextIndex(), terminal))
|
||||
|
||||
// Update the job
|
||||
job2 := mock.Job()
|
||||
job2.ID = job.ID
|
||||
|
||||
Reference in New Issue
Block a user