fix(apiserver): propagate submit user as job execuser (bug-1780)
modelJobToSubmit() never set job_startinfo_t.execuser when converting a submitted job to the C struct sent to the controller/worker, so every job ran as the worker's 'nobody' default and failed to exec (exit 126). Default execuser to the submitting user via a new resolveExecUser() pure helper, and free the newly allocated C string. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hb6Edtj4KbS8CrgEWYdA2E
This commit is contained in:
parent
37ea6dfd9f
commit
5ab344e1ae
4 changed files with 61 additions and 0 deletions
|
|
@ -273,6 +273,9 @@ func cClusterConfToClusterInfo(conf *C.cluster_config_t) *models.ClusterInfo {
|
|||
func modelJobToSubmit(job *models.JobInfo) (*C.xce_job_submit_t, *C.job_submit_data_t, *C.job_startinfo_t) {
|
||||
si := (*C.job_startinfo_t)(C.calloc(1, C.sizeof_job_startinfo_t))
|
||||
si.cmdline = C.CString(job.Command)
|
||||
if execUser := resolveExecUser(job.ExecUser, job.SubmitUser); execUser != "" {
|
||||
si.execuser = C.CString(execUser)
|
||||
}
|
||||
if job.LaunchType != "" {
|
||||
si.launch_type = C.CString(job.LaunchType)
|
||||
}
|
||||
|
|
@ -324,6 +327,7 @@ func modelJobToSubmit(job *models.JobInfo) (*C.xce_job_submit_t, *C.job_submit_d
|
|||
func freeJobSubmit(js *C.xce_job_submit_t, sd *C.job_submit_data_t, si *C.job_startinfo_t) {
|
||||
if si != nil {
|
||||
C.free(unsafe.Pointer(si.cmdline))
|
||||
C.free(unsafe.Pointer(si.execuser))
|
||||
C.free(unsafe.Pointer(si.launch_type))
|
||||
C.free(unsafe.Pointer(si.job_pre_exec))
|
||||
C.free(unsafe.Pointer(si.job_post_exec))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue