fix(service): correct CPU/memory mapping and add TRES/memory_used extraction

- Map CPUs to CpusPerTask (not MinimumCpus) for consistent SlurmDBD history

- Add Set:true to memory Uint64NoVal on submission

- Filter number=0 in mapUint64NoValToInt64 to avoid false zeros

- Extract peak memory from Steps.Tres.Requested.Max across all steps

- Add formatTresList, parseGresDetail, extractMemoryFromSteps helpers

- Update mapJobInfo and mapSlurmdbJob with new field mappings

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
dailz
2026-04-20 17:10:19 +08:00
parent d79656c728
commit d9ca9233b3
3 changed files with 125 additions and 15 deletions

View File

@@ -1048,8 +1048,12 @@ func TestProcessTask_SchedulingParams(t *testing.T) {
if j.Partition == nil || *j.Partition != "gpu" {
t.Errorf("Partition = %v, want %q", j.Partition, "gpu")
}
if j.MinimumCpus == nil || *j.MinimumCpus != int32(8) {
t.Errorf("MinimumCpus = %v, want 8", j.MinimumCpus)
// CPUs=8 maps to CpusPerTask, then overridden by explicit CpusPerTask=2
if j.CpusPerTask == nil || *j.CpusPerTask != int32(2) {
t.Errorf("CpusPerTask = %v, want 2 (explicit CpusPerTask overrides CPUs)", j.CpusPerTask)
}
if j.MinimumCpus != nil {
t.Errorf("MinimumCpus should be nil, got %v", j.MinimumCpus)
}
if j.TimeLimit == nil || j.TimeLimit.Number == nil || *j.TimeLimit.Number != int64(60) {
t.Errorf("TimeLimit = %v, want 60", j.TimeLimit)
@@ -1175,8 +1179,8 @@ func TestProcessTask_PartialSchedulingParams(t *testing.T) {
t.Errorf("Partition = %v, want %q", j.Partition, "debug")
}
if j.MinimumCpus != nil {
t.Errorf("MinimumCpus = %v, want nil (no cpus set)", j.MinimumCpus)
if j.CpusPerTask != nil {
t.Errorf("CpusPerTask = %v, want nil (no cpus set)", j.CpusPerTask)
}
if j.TimeLimit == nil {
t.Errorf("TimeLimit = nil, want non-nil (default should be injected)")