fix(apiserver): an accepted job is in the job store at once (bug-1894)
The apiserver's job store learned of a new job only from the controller's asynchronous OnJobCreated / array push, so a 'jobs kill' (or query) straight after 'jobs submit' could answer 'job not found' for the job just accepted (2 of 4 immediate kills). services.SubmitJob now records the accepted job right after the controller's reply (which comes only after the job is committed and applied): one record per element, base+i for arrays, stored with the new DataStore.PutIfAbsent and marked JobInfo.Provisional (json:"-", not a column). An OnJobCreated that already arrived is never overwritten; the push that arrives later replaces the provisional record -- including in dispatchJobArray, whose duplicate check no longer treats a provisional element as already known. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3e6c48a1fe
commit
141ac22c54
7 changed files with 177 additions and 2 deletions
|
|
@ -6,6 +6,13 @@ import (
|
|||
)
|
||||
|
||||
// SubmitJob sends a job to the backend. arraySize=1 for normal, >1 for array.
|
||||
// On success the accepted job is recorded in the job store right away
|
||||
// (bug-1894), so it can be queried and controlled before the controller's
|
||||
// asynchronous OnJobCreated push arrives.
|
||||
func SubmitJob(job *models.JobInfo, arraySize int) error {
|
||||
return backend.SubmitJob(job, arraySize)
|
||||
if err := backend.SubmitJob(job, arraySize); err != nil {
|
||||
return err
|
||||
}
|
||||
backend.RecordAcceptedJob(job, arraySize)
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue