filtering failed batch allocs

This commit is contained in:
Alex Dadgar
2016-04-11 12:51:53 -07:00
parent 8039720b10
commit 1e9650d070

View File

@@ -231,11 +231,12 @@ func (s *GenericScheduler) process() (bool, error) {
// re-placed.
func (s *GenericScheduler) filterCompleteAllocs(allocs []*structs.Allocation) []*structs.Allocation {
filter := func(a *structs.Allocation) bool {
// Allocs from batch jobs should be filtered when their status is failed so that
// they will be replaced. If they are dead but not failed, they
// Allocs from batch jobs should be filtered when their status is failed
// so that they will be replaced. If they are complete but not failed, they
// shouldn't be replaced.
if s.batch {
return a.ClientStatus == structs.AllocClientStatusFailed
return a.TerminalStatus() &&
a.ClientStatus != structs.AllocClientStatusComplete
}
// Filter terminal, non batch allocations