|
|
@@ -2,6 +2,7 @@ package sch |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
"gitlink.org.cn/cloudream/common/pkgs/types" |
|
|
"gitlink.org.cn/cloudream/common/pkgs/types" |
|
|
|
|
|
"gitlink.org.cn/cloudream/common/sdks/hpc" |
|
|
schsdk "gitlink.org.cn/cloudream/common/sdks/scheduler" |
|
|
schsdk "gitlink.org.cn/cloudream/common/sdks/scheduler" |
|
|
cdssdk "gitlink.org.cn/cloudream/common/sdks/storage" |
|
|
cdssdk "gitlink.org.cn/cloudream/common/sdks/storage" |
|
|
"gitlink.org.cn/cloudream/common/utils/serder" |
|
|
"gitlink.org.cn/cloudream/common/utils/serder" |
|
|
@@ -239,122 +240,47 @@ type ResourceRange struct { |
|
|
Ids []string `json:"ids"` |
|
|
Ids []string `json:"ids"` |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
type QueryTaskResultReq struct { |
|
|
|
|
|
TaskID string `json:"taskID" binding:"required"` |
|
|
|
|
|
UserID cdssdk.UserID `json:"userID" binding:"required"` |
|
|
|
|
|
PackageID cdssdk.PackageID `json:"packageID" binding:"required"` |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type PCMJobData struct { |
|
|
|
|
|
ID string `json:"id"` |
|
|
|
|
|
CreatedAt time.Time `json:"created_at"` |
|
|
|
|
|
Param string `json:"param"` |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type JobInfo struct { |
|
|
type JobInfo struct { |
|
|
Name string `json:"name"` |
|
|
|
|
|
Description string `json:"description,optional"` |
|
|
|
|
|
JobResources JobResources `json:"jobResources"` |
|
|
|
|
|
DataDistributeData DataDistributeData `json:"dataDistributes"` |
|
|
|
|
|
ResultFile ResultFile `json:"resultFile"` |
|
|
|
|
|
|
|
|
TaskID string `json:"taskID"` |
|
|
|
|
|
JobSubmitInfo JobSubmitInfo `json:"jobSubmitInfo"` |
|
|
|
|
|
ResultFiles []ResultFile `json:"resultFiles"` |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
type ResultFile struct { |
|
|
type ResultFile struct { |
|
|
CommonPrefixes []interface{} `json:"commonPrefixes"` |
|
|
|
|
|
Objects []Object `json:"objects"` |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Object 表示对象结构体 |
|
|
|
|
|
type Object struct { |
|
|
|
|
|
ObjectID int `json:"objectID"` |
|
|
|
|
|
PackageID int `json:"packageID"` |
|
|
|
|
|
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"` |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Redundancy 表示冗余信息结构体 |
|
|
|
|
|
type Redundancy struct { |
|
|
|
|
|
Type string `json:"type"` |
|
|
|
|
|
RepCount int `json:"repCount"` |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type DataDistributeData struct { |
|
|
|
|
|
Dataset []DataItem `json:"dataset"` |
|
|
|
|
|
Code []DataItem `json:"code"` |
|
|
|
|
|
Image []DataItem `json:"image"` |
|
|
|
|
|
Model []DataItem `json:"model"` |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// DataItem 定义 dataDistributes 中的数据项结构体 |
|
|
|
|
|
type DataItem struct { |
|
|
|
|
|
DataName string `json:"dataName"` |
|
|
|
|
|
PackageID int `json:"packageID"` |
|
|
|
|
|
PackageName string `json:"packageName"` |
|
|
|
|
|
ResourceFile string `json:"resourceFile"` |
|
|
|
|
|
Clusters []DataDetail `json:"clusters"` |
|
|
|
|
|
|
|
|
ClusterID schsdk.ClusterID `json:"clusterID"` |
|
|
|
|
|
Objects []cdssdk.Object `json:"objects"` |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
type JobResources struct { |
|
|
|
|
|
ScheduleStrategy string `json:"scheduleStrategy"` |
|
|
|
|
|
Clusters []*JobClusterInfo `json:"clusters"` |
|
|
|
|
|
|
|
|
type JobSubmitInfo interface { |
|
|
|
|
|
Noop() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
type JobClusterInfo struct { |
|
|
|
|
|
ClusterID string `json:"clusterID"` |
|
|
|
|
|
Resources []map[string]interface{} `json:"resources,optional"` |
|
|
|
|
|
Runtime JobRuntimeInfo `json:"runtime,optional"` |
|
|
|
|
|
|
|
|
type JobSubmitInfoBase struct { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
type JobRuntimeInfo struct { |
|
|
|
|
|
Command string `json:"command,optional"` |
|
|
|
|
|
Envs map[string]interface{} `json:"envs,optional"` |
|
|
|
|
|
Params map[string]interface{} `json:"params,optional"` |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
var JobSubmitInfoTypeUnion = types.NewTypeUnion[JobSubmitInfo]( |
|
|
|
|
|
(*PCMJobSubmitInfo)(nil), |
|
|
|
|
|
(*HPCJobSubmitInfo)(nil), |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
// Engine 定义 engine 结构体 |
|
|
|
|
|
type Engine struct { |
|
|
|
|
|
EngineName string `json:"EngineName"` |
|
|
|
|
|
EngineVersion string `json:"EngineVersion"` |
|
|
|
|
|
ImageUrl string `json:"ImageUrl"` |
|
|
|
|
|
InstallSysPackages bool `json:"InstallSysPackages"` |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
var _ = serder.UseTypeUnionInternallyTagged(&JobSubmitInfoTypeUnion, "type") |
|
|
|
|
|
|
|
|
// bindingCluster 定义根结构体 |
|
|
|
|
|
type BindingParam struct { |
|
|
|
|
|
Name string `json:"name"` |
|
|
|
|
|
Description string `json:"description"` |
|
|
|
|
|
Engine Engine `json:"engine"` |
|
|
|
|
|
CodeDir string `json:"codeDir"` |
|
|
|
|
|
BootFile string `json:"bootFile"` |
|
|
|
|
|
Branch string `json:"branch"` |
|
|
|
|
|
Platform string `json:"platform"` |
|
|
|
|
|
UserID int `json:"userID"` |
|
|
|
|
|
PackageId int `json:"packageId"` |
|
|
|
|
|
BucketID int `json:"bucketID"` |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func (d *JobSubmitInfoBase) Noop() {} |
|
|
|
|
|
|
|
|
// bindingCluster 定义根结构体 |
|
|
|
|
|
type BindingCluster struct { |
|
|
|
|
|
BindingId int `json:"binding_id"` |
|
|
|
|
|
ClusterId string `json:"cluster_id"` |
|
|
|
|
|
Status string `json:"status"` |
|
|
|
|
|
Param string `json:"param"` |
|
|
|
|
|
|
|
|
type PCMJobSubmitInfo struct { |
|
|
|
|
|
serder.Metadata `union:"pcm"` |
|
|
|
|
|
JobSubmitInfoBase |
|
|
|
|
|
Type string `json:"type"` |
|
|
|
|
|
Info CreatePCMJobReq `json:"info"` |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/*type TaskResult struct { |
|
|
|
|
|
Name string `json:"name"` |
|
|
|
|
|
Description string `json:"description"` |
|
|
|
|
|
DataDistribute DataDistribute `json:"dataDistributes"` |
|
|
|
|
|
|
|
|
type HPCJobSubmitInfo struct { |
|
|
|
|
|
serder.Metadata `union:"hpc"` |
|
|
|
|
|
JobSubmitInfoBase |
|
|
|
|
|
Type string `json:"type"` |
|
|
|
|
|
Info hpc.CreateHPCJobReq `json:"info"` |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
type ClusterResources struct { |
|
|
|
|
|
ClusterId string `json:"clusterId"` |
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
type Range struct { |
|
|
type Range struct { |
|
|
Min float64 `json:"min"` |
|
|
Min float64 `json:"min"` |
|
|
Max float64 `json:"max"` |
|
|
Max float64 `json:"max"` |
|
|
|