apiserver: apply the controller's jobPidInfo start-report push
handleNotifyData had no case for NotifyData_data_jobPidInfo, so the
controller's start-report push (apiserver_job_start_fun, fired from
HOOK_DETAIL_JOB_START the moment WAL_JOB_START commits) was silently
dropped. interactive_job_url then stayed invisible until the next
periodic rusage-driven job UPDATE re-delivered the full row — up to
10s later (job_rusage_collect_interval), the dominant chunk of an
-I --tty job's submit-to-first-output latency (measured ~6s on t1,
server-side work itself is ~0.6s).
Add OnJobPidInfo to the notification interface and DefaultHandler:
it merges the worker-reported pids/pgids and the exdata {"url": ...}
onto the already-stored job record (get-mutate-put, mirroring
OnJobFinished) and publishes a job.updated event. The CGO decode
side is factored into cPidInfoToRaw/pidInfoJSONB, shared with the
existing xce_job_t conversion.
Cluster-verified on t1: URL is pollable ~0.6s after submit
(previously ~11s), full submit/run/finish lifecycle clean, all
daemons healthy.
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
parent
66a1d1e680
commit
3545aa0d77
6 changed files with 168 additions and 16 deletions
|
|
@ -115,6 +115,44 @@ func (h *DefaultHandler) OnJobFinished(jobid uint64, exitCode int) {
|
|||
zap.Int("job_status", existing.JobStatus))
|
||||
}
|
||||
|
||||
// OnJobPidInfo applies a controller-pushed job start report
|
||||
// (NotifyData_data_jobPidInfo, fired from HOOK_DETAIL_JOB_START after
|
||||
// WAL_JOB_START commits) onto the already-stored job record: the worker's
|
||||
// pids/pgids become PIDInfo, and an interactive job's exdata {"url": ...}
|
||||
// becomes InteractiveJobURL — the field xcecli's waitForInteractiveURL
|
||||
// polls. Without this handler the push was silently dropped by
|
||||
// handleNotifyData and the URL stayed invisible until the next periodic
|
||||
// rusage-driven job UPDATE re-delivered the full row (up to 10s later,
|
||||
// job_rusage_collect_interval).
|
||||
//
|
||||
// Mirrors OnJobFinished's get-mutate-put-publish shape: the full job row
|
||||
// (submit spec, state, timestamps) always arrives ahead of or with the
|
||||
// start report — SUBMIT via OnJobCreated/join push, RUN state itself via
|
||||
// the dispatch-time update — so a jobid not in the store is logged and
|
||||
// dropped rather than inserted half-empty.
|
||||
func (h *DefaultHandler) OnJobPidInfo(jobid uint64, pidInfo *rawPidInfo) {
|
||||
existing, ok := store.Jobs.Get(jobid)
|
||||
if !ok {
|
||||
logger.Info("OnJobPidInfo: jobid not found in store, ignoring",
|
||||
zap.Uint64("jobid", jobid))
|
||||
return
|
||||
}
|
||||
if pidInfo != nil {
|
||||
if jb, ok := pidInfoJSONB(pidInfo.pids, pidInfo.pgids); ok {
|
||||
existing.PIDInfo = jb
|
||||
}
|
||||
existing.InteractiveJobURL = interactiveURLFromExdata(pidInfo.exdata)
|
||||
}
|
||||
store.Jobs.Put(jobid, existing)
|
||||
DefaultBroker.Publish(Event{Type: EventJobUpdated, JobID: jobid,
|
||||
Status: models.JobStateStr(existing.JobStatus), Job: &existing})
|
||||
|
||||
logger.Info("OnJobPidInfo: start report applied",
|
||||
zap.Uint64("jobid", jobid),
|
||||
zap.Int("pids", len(pidInfo.pids)),
|
||||
zap.String("interactive_job_url", existing.InteractiveJobURL))
|
||||
}
|
||||
|
||||
func (h *DefaultHandler) OnQueueUpdated(queue *models.QueueInfo) {
|
||||
store.Queues.Put(queue.QueueName, *queue)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue