Initializing the queued allocations late
This commit is contained in:
parent
09aa867cc2
commit
51cb201a09
|
@ -78,11 +78,10 @@ type GenericScheduler struct {
|
|||
// NewServiceScheduler is a factory function to instantiate a new service scheduler
|
||||
func NewServiceScheduler(logger *log.Logger, state State, planner Planner) Scheduler {
|
||||
s := &GenericScheduler{
|
||||
logger: logger,
|
||||
state: state,
|
||||
planner: planner,
|
||||
batch: false,
|
||||
queuedAllocs: make(map[string]int),
|
||||
logger: logger,
|
||||
state: state,
|
||||
planner: planner,
|
||||
batch: false,
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
@ -90,11 +89,10 @@ func NewServiceScheduler(logger *log.Logger, state State, planner Planner) Sched
|
|||
// NewBatchScheduler is a factory function to instantiate a new batch scheduler
|
||||
func NewBatchScheduler(logger *log.Logger, state State, planner Planner) Scheduler {
|
||||
s := &GenericScheduler{
|
||||
logger: logger,
|
||||
state: state,
|
||||
planner: planner,
|
||||
batch: true,
|
||||
queuedAllocs: make(map[string]int),
|
||||
logger: logger,
|
||||
state: state,
|
||||
planner: planner,
|
||||
batch: true,
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
@ -181,6 +179,7 @@ func (s *GenericScheduler) createBlockedEval(planFailure bool) error {
|
|||
// process is wrapped in retryMax to iteratively run the handler until we have no
|
||||
// further work or we've made the maximum number of attempts.
|
||||
func (s *GenericScheduler) process() (bool, error) {
|
||||
s.queuedAllocs = make(map[string]int)
|
||||
// Lookup the Job by ID
|
||||
var err error
|
||||
s.job, err = s.state.JobByID(s.eval.JobID)
|
||||
|
|
|
@ -45,10 +45,9 @@ type SystemScheduler struct {
|
|||
// scheduler.
|
||||
func NewSystemScheduler(logger *log.Logger, state State, planner Planner) Scheduler {
|
||||
return &SystemScheduler{
|
||||
logger: logger,
|
||||
state: state,
|
||||
planner: planner,
|
||||
queuedAllocs: make(map[string]int),
|
||||
logger: logger,
|
||||
state: state,
|
||||
planner: planner,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,6 +85,7 @@ func (s *SystemScheduler) Process(eval *structs.Evaluation) error {
|
|||
// process is wrapped in retryMax to iteratively run the handler until we have no
|
||||
// further work or we've made the maximum number of attempts.
|
||||
func (s *SystemScheduler) process() (bool, error) {
|
||||
s.queuedAllocs = make(map[string]int)
|
||||
// Lookup the Job by ID
|
||||
var err error
|
||||
s.job, err = s.state.JobByID(s.eval.JobID)
|
||||
|
|
Loading…
Reference in New Issue