Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
120 lines
7.5 KiB
Go
120 lines
7.5 KiB
Go
package model
|
||
|
||
// SubmitJobRequest 是提交作业的 API 请求。
|
||
type SubmitJobRequest struct {
|
||
Script string `json:"script"` // 作业脚本内容
|
||
Partition string `json:"partition,omitempty"` // 提交到的分区
|
||
QOS string `json:"qos,omitempty"` // 使用的 QOS 策略
|
||
CPUs int32 `json:"cpus,omitempty"` // 请求的 CPU 核数
|
||
Memory string `json:"memory,omitempty"` // Deprecated: Use MemoryPerNode or MemoryPerCpu instead
|
||
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"` // 作业工作目录
|
||
|
||
MemoryPerNode *int64 `json:"memory_per_node,omitempty"` // 每节点内存(MB)
|
||
MemoryPerCpu *int64 `json:"memory_per_cpu,omitempty"` // 每CPU内存(MB)
|
||
Nodes *string `json:"nodes,omitempty"` // 请求的节点数(支持范围如"2-4")
|
||
Tasks *int32 `json:"tasks,omitempty"` // 任务数
|
||
CpusPerTask *int32 `json:"cpus_per_task,omitempty"` // 每任务CPU核数
|
||
Constraints *string `json:"constraints,omitempty"` // 节点特性约束
|
||
Reservation *string `json:"reservation,omitempty"` // 预约名称
|
||
Account *string `json:"account,omitempty"` // 计费账户
|
||
Nice *int32 `json:"nice,omitempty"` // nice调整值
|
||
MailType *string `json:"mail_type,omitempty"` // 邮件通知类型(逗号分隔)
|
||
MailUser *string `json:"mail_user,omitempty"` // 邮件地址
|
||
StandardOutput *string `json:"standard_output,omitempty"` // 标准输出路径
|
||
StandardError *string `json:"standard_error,omitempty"` // 标准错误路径
|
||
StandardInput *string `json:"standard_input,omitempty"` // 标准输入路径
|
||
RequiredNodes *string `json:"required_nodes,omitempty"` // 指定运行的节点(逗号分隔)
|
||
ExcludedNodes *string `json:"excluded_nodes,omitempty"` // 排除的节点(逗号分隔)
|
||
BeginTime *int64 `json:"begin_time,omitempty"` // 最早开始时间(Unix时间戳)
|
||
Deadline *int64 `json:"deadline,omitempty"` // 截止时间(Unix时间戳)
|
||
Array *string `json:"array,omitempty"` // 数组作业规格
|
||
Dependency *string `json:"dependency,omitempty"` // 作业依赖关系
|
||
Requeue *bool `json:"requeue,omitempty"` // 失败后是否重新排队
|
||
KillOnNodeFail *bool `json:"kill_on_node_fail,omitempty"` // 节点故障时是否终止作业
|
||
}
|
||
|
||
// JobResponse 是作业查询 API 响应。
|
||
type JobResponse struct {
|
||
// Identity
|
||
JobID int32 `json:"job_id"` // Slurm 作业 ID
|
||
Name string `json:"name"` // 作业名称
|
||
State []string `json:"job_state"` // 作业当前状态 (e.g. ["RUNNING"], ["PENDING","REQUEUED"])
|
||
StateReason string `json:"state_reason,omitempty"` // 作业等待/失败的原因
|
||
|
||
// Scheduling
|
||
Partition string `json:"partition"` // 所属分区
|
||
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 是作业列表分页响应。
|
||
type JobListResponse struct {
|
||
Jobs []JobResponse `json:"jobs"` // 作业列表
|
||
Total int `json:"total"` // 符合条件的作业总数
|
||
Page int `json:"page"` // 当前页码 (从 1 开始)
|
||
PageSize int `json:"page_size"` // 每页条数
|
||
}
|
||
|
||
// JobListQuery 是活跃作业列表查询参数。
|
||
type JobListQuery struct {
|
||
Page int `form:"page,default=1" json:"page,omitempty"` // 页码 (从 1 开始)
|
||
PageSize int `form:"page_size,default=20" json:"page_size,omitempty"` // 每页条数
|
||
}
|
||
|
||
// JobHistoryQuery 是作业历史查询参数。
|
||
type JobHistoryQuery struct {
|
||
Users string `form:"users" json:"users,omitempty"` // 按用户名过滤 (逗号分隔)
|
||
StartTime string `form:"start_time" json:"start_time,omitempty"` // 作业开始时间下限 (Unix 时间戳)
|
||
EndTime string `form:"end_time" json:"end_time,omitempty"` // 作业结束时间上限 (Unix 时间戳)
|
||
SubmitTime string `form:"submit_time" json:"submit_time,omitempty"` // 作业提交时间过滤 (Unix 时间戳)
|
||
Account string `form:"account" json:"account,omitempty"` // 按计费账户过滤
|
||
Partition string `form:"partition" json:"partition,omitempty"` // 按分区过滤
|
||
State string `form:"state" json:"state,omitempty"` // 按作业状态过滤 (e.g. "COMPLETED", "FAILED")
|
||
JobName string `form:"job_name" json:"job_name,omitempty"` // 按作业名称过滤
|
||
Cluster string `form:"cluster" json:"cluster,omitempty"` // 按集群名称过滤
|
||
Qos string `form:"qos" json:"qos,omitempty"` // 按 QOS 策略过滤
|
||
Constraints string `form:"constraints" json:"constraints,omitempty"` // 按节点约束过滤
|
||
ExitCode string `form:"exit_code" json:"exit_code,omitempty"` // 按退出码过滤
|
||
Node string `form:"node" json:"node,omitempty"` // 按分配节点过滤
|
||
Reservation string `form:"reservation" json:"reservation,omitempty"` // 按预约名称过滤
|
||
Groups string `form:"groups" json:"groups,omitempty"` // 按用户组过滤
|
||
Wckey string `form:"wckey" json:"wckey,omitempty"` // 按 WCKey (Workload Characterization Key) 过滤
|
||
Page int `form:"page,default=1" json:"page,omitempty"` // 页码 (从 1 开始)
|
||
PageSize int `form:"page_size,default=20" json:"page_size,omitempty"` // 每页条数
|
||
}
|