Initializing the queued allocations late

This commit is contained in:
Diptanu Choudhury 2016-07-22 16:48:42 -07:00
parent 09aa867cc2
commit 51cb201a09
2 changed files with 13 additions and 14 deletions

View File

@ -82,7 +82,6 @@ func NewServiceScheduler(logger *log.Logger, state State, planner Planner) Sched
state: state, state: state,
planner: planner, planner: planner,
batch: false, batch: false,
queuedAllocs: make(map[string]int),
} }
return s return s
} }
@ -94,7 +93,6 @@ func NewBatchScheduler(logger *log.Logger, state State, planner Planner) Schedul
state: state, state: state,
planner: planner, planner: planner,
batch: true, batch: true,
queuedAllocs: make(map[string]int),
} }
return s 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 // 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. // further work or we've made the maximum number of attempts.
func (s *GenericScheduler) process() (bool, error) { func (s *GenericScheduler) process() (bool, error) {
s.queuedAllocs = make(map[string]int)
// Lookup the Job by ID // Lookup the Job by ID
var err error var err error
s.job, err = s.state.JobByID(s.eval.JobID) s.job, err = s.state.JobByID(s.eval.JobID)

View File

@ -48,7 +48,6 @@ func NewSystemScheduler(logger *log.Logger, state State, planner Planner) Schedu
logger: logger, logger: logger,
state: state, state: state,
planner: planner, planner: planner,
queuedAllocs: make(map[string]int),
} }
} }
@ -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 // 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. // further work or we've made the maximum number of attempts.
func (s *SystemScheduler) process() (bool, error) { func (s *SystemScheduler) process() (bool, error) {
s.queuedAllocs = make(map[string]int)
// Lookup the Job by ID // Lookup the Job by ID
var err error var err error
s.job, err = s.state.JobByID(s.eval.JobID) s.job, err = s.state.JobByID(s.eval.JobID)