247 lines
8.1 KiB
Go
247 lines
8.1 KiB
Go
package models
|
|
|
|
import "time"
|
|
|
|
// SubtaskRequest 表示子任务请求
|
|
type SubtaskRequest struct {
|
|
UserID int `json:"userID"`
|
|
JobSetInfo JobSetInfo `json:"jobSetInfo"`
|
|
}
|
|
|
|
// JobSetInfo 表示任务集信息
|
|
type JobSetInfo struct {
|
|
Jobs []Job `json:"jobs"`
|
|
}
|
|
|
|
// Job 表示单个任务
|
|
type Job struct {
|
|
LocalJobID string `json:"localJobID"`
|
|
Name string `json:"name,omitempty"`
|
|
Description string `json:"description,omitempty"`
|
|
Type string `json:"type"`
|
|
Files *JobFiles `json:"files,omitempty"`
|
|
JobResources *JobResources `json:"jobResources,omitempty"`
|
|
TargetJob []TargetJob `json:"targetJob,omitempty"`
|
|
}
|
|
|
|
// JobFiles 表示任务关联的文件
|
|
type JobFiles struct {
|
|
Dataset FileBinding `json:"dataset"`
|
|
Model FileBinding `json:"model,omitempty"`
|
|
Image ImageBinding `json:"image"`
|
|
}
|
|
|
|
// FileBinding 表示文件绑定信息
|
|
type FileBinding struct {
|
|
Type string `json:"type"`
|
|
BindingID int `json:"bindingID"`
|
|
}
|
|
|
|
// ImageBinding 表示镜像绑定信息
|
|
type ImageBinding struct {
|
|
Type string `json:"type"`
|
|
ImageID int `json:"imageID"`
|
|
}
|
|
|
|
// JobResources 表示任务资源
|
|
type JobResources struct {
|
|
ScheduleStrategy string `json:"scheduleStrategy"`
|
|
Clusters []Cluster `json:"clusters"`
|
|
}
|
|
|
|
// Cluster 表示集群信息
|
|
type Cluster struct {
|
|
ClusterID string `json:"clusterID"`
|
|
Runtime Runtime `json:"runtime"`
|
|
Code CodeInfo `json:"code"`
|
|
Resources []ResourcesItem `json:"resources"`
|
|
}
|
|
|
|
// Runtime 表示运行时配置
|
|
type Runtime struct {
|
|
Envs map[string]string `json:"envs"`
|
|
Params map[string]string `json:"params"`
|
|
}
|
|
|
|
// CodeInfo 表示代码信息
|
|
type CodeInfo struct {
|
|
Type string `json:"type"`
|
|
BindingID int `json:"bindingID"`
|
|
}
|
|
|
|
// Resource 表示资源需求
|
|
type Resource struct {
|
|
Type string `json:"type"`
|
|
Name string `json:"name"`
|
|
Number int `json:"number"`
|
|
}
|
|
|
|
// TargetJob 表示目标任务
|
|
type TargetJob struct {
|
|
TargetJobID string `json:"targetJobID"`
|
|
InputParams InputParams `json:"inputParams"`
|
|
}
|
|
|
|
// InputParams 表示输入参数
|
|
type InputParams struct {
|
|
PackageName string `json:"PackageName"`
|
|
ClusterID string `json:"ClusterID"`
|
|
Output string `json:"Output"`
|
|
}
|
|
|
|
// SubmitTaskResponse 任务提交响应
|
|
type SubmitTaskResponse struct {
|
|
Code string `json:"code"` // 状态码(字符串类型)
|
|
Message string `json:"message"` // 消息
|
|
Data Data `json:"data"` // 响应数据
|
|
}
|
|
|
|
// Data 响应数据
|
|
type Data struct {
|
|
JobSetID string `json:"jobSetID"` // 任务集ID
|
|
Message string `json:"message"` // 数据层消息
|
|
}
|
|
|
|
type TaskQueryRequest struct {
|
|
JobSetID string `json:"jobSetID"` // 用户ID
|
|
LocalJobID string `json:"localJobID"` // 页码
|
|
}
|
|
|
|
// TaskDetailResponse 任务详情查询响应
|
|
type TaskDetailResponse struct {
|
|
Code string `json:"code"` // 状态码
|
|
Message string `json:"message"` // 消息
|
|
Data TaskDetailData `json:"data"` // 任务详情数据
|
|
}
|
|
|
|
// TaskDetailData 任务详情数据
|
|
type TaskDetailData struct {
|
|
Name string `json:"name"` // 任务名称
|
|
Description string `json:"description"` // 任务描述
|
|
StartTime string `json:"startTime"` // 开始时间
|
|
EndTime string `json:"endTime"` // 结束时间
|
|
Strategy int `json:"strategy"` // 策略
|
|
SynergyStatus int `json:"synergyStatus"` // 协同状态
|
|
ClusterInfos []ClusterItem `json:"clusterInfos"` // 集群信息列表
|
|
SubTaskInfos []SubTaskInfo `json:"subTaskInfos"` // 子任务信息列表
|
|
TaskTypeDict string `json:"taskTypeDict"` // 任务类型字典
|
|
AdapterTypeDict string `json:"adapterTypeDict"` // 适配器类型字典
|
|
}
|
|
|
|
// SubTaskInfo 子任务信息
|
|
type SubTaskInfo struct {
|
|
ID string `json:"id"` // 子任务ID
|
|
Name string `json:"name"` // 子任务名称
|
|
ClusterID string `json:"clusterId"` // 集群ID
|
|
ClusterName string `json:"clusterName"` // 集群名称
|
|
Status string `json:"status"` // 任务状态
|
|
Remark string `json:"remark"` // 备注
|
|
InferURL string `json:"inferUrl"` // 推理URL
|
|
WorkDir string `json:"workDir"` // 工作目录
|
|
AppName string `json:"appName"` // 应用名称
|
|
}
|
|
|
|
// TaskLogResponse 任务日志响应
|
|
type TaskLogResponse struct {
|
|
Code string `json:"code"`
|
|
Message string `json:"message"`
|
|
Data string `json:"data"`
|
|
}
|
|
|
|
// TaskResultDetailResponse 任务详情响应
|
|
type TaskResultDetailResponse struct {
|
|
Code string `json:"code"` // 状态码
|
|
Message string `json:"message"` // 消息
|
|
Data TaskResultDetailData `json:"data"` // 任务详情数据
|
|
}
|
|
|
|
// TaskResultDetailData 任务详情数据
|
|
type TaskResultDetailData struct {
|
|
PcmJobData PcmJobData `json:"pcmJobData"` // PCM任务数据
|
|
}
|
|
|
|
// PcmJobData PCM任务数据
|
|
type PcmJobData struct {
|
|
TaskID string `json:"taskID"` // 任务ID
|
|
JobSubmitInfo JobSubmitInfo `json:"jobSubmitInfo"` // 任务提交信息
|
|
ResultFiles []ResultFile `json:"resultFiles"` // 结果文件列表
|
|
Status string `json:"status"` // 任务状态
|
|
ErrorMsg string `json:"errorMsg"` // 错误消息
|
|
}
|
|
|
|
// JobSubmitInfo 任务提交信息
|
|
type JobSubmitInfo struct {
|
|
Type string `json:"type"` // 类型
|
|
Info JobSubmitInfoDetail `json:"info"` // 任务详情
|
|
}
|
|
|
|
// JobSubmitInfoDetail 任务提交详情
|
|
type JobSubmitInfoDetail struct {
|
|
Name string `json:"name"` // 任务名称
|
|
Description string `json:"description"` // 任务描述
|
|
JobResources JobResources `json:"jobResources"` // 任务资源
|
|
DataDistributes DataDistributes `json:"dataDistributes"` // 数据分布
|
|
}
|
|
|
|
// DataDistributes 数据分布
|
|
type DataDistributes struct {
|
|
Dataset []DatasetDistribute `json:"dataset"` // 数据集分布
|
|
Code []CodeDistribute `json:"code"` // 代码分布
|
|
Image []ImageDistribute `json:"image"` // 镜像分布
|
|
Model []ModelDistribute `json:"model"` // 模型分布
|
|
}
|
|
|
|
// DatasetDistribute 数据集分布
|
|
type DatasetDistribute struct {
|
|
DataName string `json:"dataName"` // 数据名称
|
|
PackageID int `json:"packageID"` // 包ID
|
|
Clusters []ClusterStorage `json:"clusters"` // 集群存储
|
|
}
|
|
|
|
// CodeDistribute 代码分布
|
|
type CodeDistribute struct {
|
|
DataName string `json:"dataName"` // 数据名称
|
|
PackageID int `json:"packageID"` // 包ID
|
|
Output string `json:"output"` // 输出路径
|
|
Clusters []ClusterStorage `json:"clusters"` // 集群存储
|
|
}
|
|
|
|
// ImageDistribute 镜像分布
|
|
type ImageDistribute struct {
|
|
DataName string `json:"dataName"` // 数据名称
|
|
PackageID int `json:"packageID"` // 包ID
|
|
Clusters []ClusterStorage `json:"clusters"` // 集群存储
|
|
}
|
|
|
|
// ModelDistribute 模型分布
|
|
type ModelDistribute struct {
|
|
DataName string `json:"dataName"` // 数据名称
|
|
PackageID int `json:"packageID"` // 包ID
|
|
Clusters []ClusterStorage `json:"clusters"` // 集群存储
|
|
}
|
|
|
|
// ClusterStorage 集群存储信息
|
|
type ClusterStorage struct {
|
|
ClusterID string `json:"clusterID"` // 集群ID
|
|
StorageID int `json:"storageID"` // 存储ID
|
|
JsonData string `json:"jsonData"` // JSON数据
|
|
}
|
|
|
|
// ResultFile 结果文件
|
|
type ResultFile struct {
|
|
ClusterID string `json:"clusterID"` // 集群ID
|
|
Objects []ResultObject `json:"objects"` // 结果对象列表
|
|
}
|
|
|
|
// ResultObject 结果对象
|
|
type ResultObject struct {
|
|
ObjectID int `json:"objectID"` // 对象ID
|
|
PackageID int `json:"packageID"` // 包ID
|
|
Path string `json:"path"` // 路径
|
|
Size string `json:"size"` // 大小
|
|
FileHash string `json:"fileHash"` // 文件哈希
|
|
Redundancy Redundancy `json:"redundancy"` // 冗余配置
|
|
CreateTime time.Time `json:"createTime"` // 创建时间
|
|
UpdateTime time.Time `json:"updateTime"` // 更新时间
|
|
}
|