feat(model): expand API response fields to expose full Slurm data
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -1,23 +1,73 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
// NodeResponse is the simplified API response for a node.
|
// NodeResponse is the API response for a node.
|
||||||
type NodeResponse struct {
|
type NodeResponse struct {
|
||||||
Name string `json:"name"`
|
// Identity
|
||||||
State []string `json:"state"`
|
Name string `json:"name"` // 节点主机名
|
||||||
CPUs int32 `json:"cpus"`
|
State []string `json:"state"` // 节点状态 (e.g. ["IDLE"], ["ALLOCATED","COMPLETING"])
|
||||||
RealMemory int64 `json:"real_memory"`
|
Reason string `json:"reason,omitempty"` // 节点 DOWN/DRAIN 的原因
|
||||||
AllocMem int64 `json:"alloc_memory,omitempty"`
|
ReasonSetByUser string `json:"reason_set_by_user,omitempty"` // 设置原因的用户
|
||||||
Arch string `json:"architecture,omitempty"`
|
|
||||||
OS string `json:"operating_system,omitempty"`
|
// CPU Resources
|
||||||
|
CPUs int32 `json:"cpus"` // 总 CPU 核数
|
||||||
|
AllocCpus *int32 `json:"alloc_cpus,omitempty"` // 已分配 CPU 核数
|
||||||
|
Cores *int32 `json:"cores,omitempty"` // 物理核心数
|
||||||
|
Sockets *int32 `json:"sockets,omitempty"` // CPU 插槽数
|
||||||
|
Threads *int32 `json:"threads,omitempty"` // 每核线程数
|
||||||
|
CpuLoad *int32 `json:"cpu_load,omitempty"` // CPU 负载 (内核 nice 值乘以 100)
|
||||||
|
|
||||||
|
// Memory (MiB)
|
||||||
|
RealMemory int64 `json:"real_memory"` // 物理内存总量
|
||||||
|
AllocMemory int64 `json:"alloc_memory,omitempty"` // 已分配内存
|
||||||
|
FreeMem *int64 `json:"free_mem,omitempty"` // 空闲内存
|
||||||
|
|
||||||
|
// Hardware
|
||||||
|
Arch string `json:"architecture,omitempty"` // 系统架构 (e.g. x86_64)
|
||||||
|
OS string `json:"operating_system,omitempty"` // 操作系统版本
|
||||||
|
Gres string `json:"gres,omitempty"` // 可用通用资源 (e.g. "gpu:4")
|
||||||
|
GresUsed string `json:"gres_used,omitempty"` // 已使用的通用资源 (e.g. "gpu:2")
|
||||||
|
|
||||||
|
// Network
|
||||||
|
Address string `json:"address,omitempty"` // 节点地址 (IP)
|
||||||
|
Hostname string `json:"hostname,omitempty"` // 节点主机名 (可能与 Name 不同)
|
||||||
|
|
||||||
|
// Scheduling
|
||||||
|
Weight *int32 `json:"weight,omitempty"` // 调度权重
|
||||||
|
Features string `json:"features,omitempty"` // 节点特性标签 (可修改)
|
||||||
|
ActiveFeatures string `json:"active_features,omitempty"` // 当前生效的特性标签 (只读)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PartitionResponse is the simplified API response for a partition.
|
// PartitionResponse is the API response for a partition.
|
||||||
type PartitionResponse struct {
|
type PartitionResponse struct {
|
||||||
Name string `json:"name"`
|
// Identity
|
||||||
State []string `json:"state"`
|
Name string `json:"name"` // 分区名称
|
||||||
Nodes string `json:"nodes,omitempty"`
|
State []string `json:"state"` // 分区状态 (e.g. ["UP"], ["DOWN","DRAIN"])
|
||||||
TotalCPUs int32 `json:"total_cpus,omitempty"`
|
Default bool `json:"default,omitempty"` // 是否为默认分区
|
||||||
TotalNodes int32 `json:"total_nodes,omitempty"`
|
|
||||||
MaxTime string `json:"max_time,omitempty"`
|
// Nodes
|
||||||
Default bool `json:"default,omitempty"`
|
Nodes string `json:"nodes,omitempty"` // 分区包含的节点列表
|
||||||
|
TotalNodes int32 `json:"total_nodes,omitempty"` // 节点总数
|
||||||
|
|
||||||
|
// CPUs
|
||||||
|
TotalCPUs int32 `json:"total_cpus,omitempty"` // CPU 总核数
|
||||||
|
MaxCPUsPerNode *int32 `json:"max_cpus_per_node,omitempty"` // 每节点最大 CPU 核数
|
||||||
|
|
||||||
|
// Limits
|
||||||
|
MaxTime string `json:"max_time,omitempty"` // 最大运行时间 (分钟,"UNLIMITED" 表示无限)
|
||||||
|
MaxNodes *int32 `json:"max_nodes,omitempty"` // 单作业最大节点数
|
||||||
|
MinNodes *int32 `json:"min_nodes,omitempty"` // 单作业最小节点数
|
||||||
|
DefaultTime string `json:"default_time,omitempty"` // 默认运行时间限制
|
||||||
|
GraceTime *int32 `json:"grace_time,omitempty"` // 作业抢占后的宽限时间 (秒)
|
||||||
|
|
||||||
|
// Priority
|
||||||
|
Priority *int32 `json:"priority,omitempty"` // 分区内作业优先级因子
|
||||||
|
|
||||||
|
// Access Control - QOS
|
||||||
|
QOSAllowed string `json:"qos_allowed,omitempty"` // 允许使用的 QOS 列表
|
||||||
|
QOSDeny string `json:"qos_deny,omitempty"` // 禁止使用的 QOS 列表
|
||||||
|
QOSAssigned string `json:"qos_assigned,omitempty"` // 分区默认分配的 QOS
|
||||||
|
|
||||||
|
// Access Control - Accounts
|
||||||
|
AccountsAllowed string `json:"accounts_allowed,omitempty"` // 允许使用的账户列表
|
||||||
|
AccountsDeny string `json:"accounts_deny,omitempty"` // 禁止使用的账户列表
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,17 +12,50 @@ type SubmitJobRequest struct {
|
|||||||
Environment map[string]string `json:"environment,omitempty"`
|
Environment map[string]string `json:"environment,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// JobResponse is the simplified API response for a job.
|
// JobResponse is the API response for a job.
|
||||||
type JobResponse struct {
|
type JobResponse struct {
|
||||||
JobID int32 `json:"job_id"`
|
// Identity
|
||||||
Name string `json:"name"`
|
JobID int32 `json:"job_id"` // Slurm 作业 ID
|
||||||
State []string `json:"job_state"`
|
Name string `json:"name"` // 作业名称
|
||||||
Partition string `json:"partition"`
|
State []string `json:"job_state"` // 作业当前状态 (e.g. ["RUNNING"], ["PENDING","REQUEUED"])
|
||||||
SubmitTime *int64 `json:"submit_time,omitempty"`
|
StateReason string `json:"state_reason,omitempty"` // 作业等待/失败的原因
|
||||||
StartTime *int64 `json:"start_time,omitempty"`
|
|
||||||
EndTime *int64 `json:"end_time,omitempty"`
|
// Scheduling
|
||||||
ExitCode *int32 `json:"exit_code,omitempty"`
|
Partition string `json:"partition"` // 所属分区
|
||||||
Nodes string `json:"nodes,omitempty"`
|
QOS string `json:"qos,omitempty"` // 使用的 QOS 策略
|
||||||
|
Priority *int32 `json:"priority,omitempty"` // 作业优先级
|
||||||
|
TimeLimit string `json:"time_limit,omitempty"` // 运行时间限制 (分钟,"UNLIMITED" 表示无限)
|
||||||
|
|
||||||
|
// Ownership
|
||||||
|
Account string `json:"account,omitempty"` // 计费账户
|
||||||
|
User string `json:"user,omitempty"` // 提交用户
|
||||||
|
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"` // 批处理主节点
|
||||||
|
|
||||||
|
// Timing (Unix timestamp)
|
||||||
|
SubmitTime *int64 `json:"submit_time,omitempty"` // 提交时间
|
||||||
|
StartTime *int64 `json:"start_time,omitempty"` // 开始运行时间
|
||||||
|
EndTime *int64 `json:"end_time,omitempty"` // 结束/预计结束时间
|
||||||
|
|
||||||
|
// Result
|
||||||
|
ExitCode *int32 `json:"exit_code,omitempty"` // 退出码 (nil 表示未结束)
|
||||||
|
|
||||||
|
// IO Paths
|
||||||
|
StdOut string `json:"standard_output,omitempty"` // 标准输出文件路径
|
||||||
|
StdErr string `json:"standard_error,omitempty"` // 标准错误文件路径
|
||||||
|
StdIn string `json:"standard_input,omitempty"` // 标准输入文件路径
|
||||||
|
WorkDir string `json:"working_directory,omitempty"` // 工作目录
|
||||||
|
Command string `json:"command,omitempty"` // 执行的命令
|
||||||
|
|
||||||
|
// Array Job
|
||||||
|
ArrayJobID *int32 `json:"array_job_id,omitempty"` // 数组作业的父 Job ID
|
||||||
|
ArrayTaskID *int32 `json:"array_task_id,omitempty"` // 数组作业中的子任务 ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// JobListResponse is the paginated response for job listings.
|
// JobListResponse is the paginated response for job listings.
|
||||||
|
|||||||
Reference in New Issue
Block a user