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 <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -10,6 +10,7 @@ type SubmitJobRequest struct {
|
|||||||
TimeLimit string `json:"time_limit,omitempty"` // 运行时间限制 (分钟)
|
TimeLimit string `json:"time_limit,omitempty"` // 运行时间限制 (分钟)
|
||||||
JobName string `json:"job_name,omitempty"` // 作业名称
|
JobName string `json:"job_name,omitempty"` // 作业名称
|
||||||
Environment map[string]string `json:"environment,omitempty"` // 环境变量键值对
|
Environment map[string]string `json:"environment,omitempty"` // 环境变量键值对
|
||||||
|
WorkDir string `json:"work_dir,omitempty"` // 作业工作目录
|
||||||
}
|
}
|
||||||
|
|
||||||
// JobResponse is the API response for a job.
|
// JobResponse is the API response for a job.
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ func (s *JobService) SubmitJob(ctx context.Context, req *model.SubmitJobRequest)
|
|||||||
Qos: strToPtrOrNil(req.QOS),
|
Qos: strToPtrOrNil(req.QOS),
|
||||||
Name: strToPtrOrNil(req.JobName),
|
Name: strToPtrOrNil(req.JobName),
|
||||||
}
|
}
|
||||||
|
if req.WorkDir != "" {
|
||||||
|
jobDesc.CurrentWorkingDirectory = &req.WorkDir
|
||||||
|
}
|
||||||
if req.CPUs > 0 {
|
if req.CPUs > 0 {
|
||||||
jobDesc.MinimumCpus = slurm.Ptr(req.CPUs)
|
jobDesc.MinimumCpus = slurm.Ptr(req.CPUs)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user