From d79656c72846d3fde64f16be7b33b4fc53acfff9 Mon Sep 17 00:00:00 2001 From: dailz Date: Mon, 20 Apr 2026 17:09:52 +0800 Subject: [PATCH] feat(model): add resource fields to JobResponse (CPU, memory, TRES, elapsed) Add CpusPerTask, MemoryPerCpu, MemoryPerNode, MemoryUsed, TRES strings, GresDetail, and Elapsed fields to capture full Slurm job resource info. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- internal/model/job.go | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/internal/model/job.go b/internal/model/job.go index 9fbc0f2..aa8c92a 100644 --- a/internal/model/job.go +++ b/internal/model/job.go @@ -56,16 +56,28 @@ type JobResponse struct { Cluster string `json:"cluster,omitempty"` // 所属集群 // Resources - Cpus *int32 `json:"cpus,omitempty"` // 分配/请求的 CPU 核数 - Tasks *int32 `json:"tasks,omitempty"` // 任务数 - NodeCount *int32 `json:"node_count,omitempty"` // 节点数 - Nodes string `json:"nodes,omitempty"` // 分配的节点列表 - BatchHost string `json:"batch_host,omitempty"` // 批处理主节点 + Cpus *int32 `json:"cpus,omitempty"` // 分配/请求的 CPU 核数 + CpusPerTask *int32 `json:"cpus_per_task,omitempty"` // 每任务 CPU 核数 + Tasks *int32 `json:"tasks,omitempty"` // 任务数 + NodeCount *int32 `json:"node_count,omitempty"` // 节点数 + Nodes string `json:"nodes,omitempty"` // 分配的节点列表 + BatchHost string `json:"batch_host,omitempty"` // 批处理主节点 + MemoryPerCpu *int64 `json:"memory_per_cpu,omitempty"` // 每 CPU 内存 (MB) + MemoryPerNode *int64 `json:"memory_per_node,omitempty"` // 每节点内存 (MB) + MemoryUsed *int64 `json:"memory_used,omitempty"` // 实际峰值内存消耗 (MB,仅历史作业) + + // TRES (Trackable Resources) + TresReqStr string `json:"tres_req_str,omitempty"` // 请求的 TRES 字符串 (活跃作业) + TresAllocStr string `json:"tres_alloc_str,omitempty"` // 分配的 TRES 字符串 (活跃作业) + TresRequested string `json:"tres_requested,omitempty"` // 请求的 TRES (历史作业) + TresAllocated string `json:"tres_allocated,omitempty"` // 分配的 TRES (历史作业,最接近实际消耗) + GresDetail []string `json:"gres_detail,omitempty"` // GPU/GRES 详情 // Timing (Unix timestamp) SubmitTime *int64 `json:"submit_time,omitempty"` // 提交时间 StartTime *int64 `json:"start_time,omitempty"` // 开始运行时间 EndTime *int64 `json:"end_time,omitempty"` // 结束/预计结束时间 + Elapsed *int32 `json:"elapsed,omitempty"` // 运行时长 (秒,仅历史作业) // Result ExitCode *int32 `json:"exit_code,omitempty"` // 退出码 (nil 表示未结束)