mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 02:15:43 +03:00
Updating the job summary table only if an evaluation has any Queued Allocations
This commit is contained in:
@@ -658,13 +658,27 @@ func (s *StateStore) nestedUpsertEval(txn *memdb.Txn, index uint64, eval *struct
|
||||
}
|
||||
if summaryRaw != nil {
|
||||
js := summaryRaw.(*structs.JobSummary)
|
||||
var hasSummaryChanged bool
|
||||
for tg, num := range eval.QueuedAllocations {
|
||||
if summary, ok := js.Summary[tg]; ok {
|
||||
summary.Queued = num
|
||||
js.Summary[tg] = summary
|
||||
hasSummaryChanged = true
|
||||
} else {
|
||||
s.logger.Printf("[ERR] state_store: unable to update queued for job %q and task group %q", eval.JobID, tg)
|
||||
}
|
||||
}
|
||||
|
||||
// Insert the job summary
|
||||
if hasSummaryChanged {
|
||||
js.ModifyIndex = index
|
||||
if err := txn.Insert("job_summary", js); err != nil {
|
||||
return fmt.Errorf("job summary insert failed: %v", err)
|
||||
}
|
||||
if err := txn.Insert("index", &IndexEntry{"job_summary", index}); err != nil {
|
||||
return fmt.Errorf("index update failed: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Insert the eval
|
||||
|
||||
Reference in New Issue
Block a user