From 32f5792b68ed5f01ad244b1ca1ae724fc883b3a7 Mon Sep 17 00:00:00 2001 From: dailz Date: Mon, 13 Apr 2026 17:12:28 +0800 Subject: [PATCH] feat(service): pass work directory to Slurm job submission Add WorkDir to SubmitJobRequest and pass it as CurrentWorkingDirectory to Slurm REST API. Fixes Slurm 500 error when working directory is not specified. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- internal/model/job.go | 1 + internal/service/job_service.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/internal/model/job.go b/internal/model/job.go index d9b5268..dcc282e 100644 --- a/internal/model/job.go +++ b/internal/model/job.go @@ -10,6 +10,7 @@ type SubmitJobRequest struct { TimeLimit string `json:"time_limit,omitempty"` // 运行时间限制 (分钟) JobName string `json:"job_name,omitempty"` // 作业名称 Environment map[string]string `json:"environment,omitempty"` // 环境变量键值对 + WorkDir string `json:"work_dir,omitempty"` // 作业工作目录 } // JobResponse is the API response for a job. diff --git a/internal/service/job_service.go b/internal/service/job_service.go index ce84f47..7c8d72a 100644 --- a/internal/service/job_service.go +++ b/internal/service/job_service.go @@ -32,6 +32,9 @@ func (s *JobService) SubmitJob(ctx context.Context, req *model.SubmitJobRequest) Qos: strToPtrOrNil(req.QOS), Name: strToPtrOrNil(req.JobName), } + if req.WorkDir != "" { + jobDesc.CurrentWorkingDirectory = &req.WorkDir + } if req.CPUs > 0 { jobDesc.MinimumCpus = slurm.Ptr(req.CPUs) }