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) }