JCC-CSScheduler/common/models/job/job.go

60 lines
1.9 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package jobmod
import (
schsdk "gitlink.org.cn/cloudream/common/sdks/scheduler"
cdssdk "gitlink.org.cn/cloudream/common/sdks/storage"
)
type FileScheduleAction string
// 文件调度方案
const (
ActionNo FileScheduleAction = "No" // 不需要操作
ActionMove FileScheduleAction = "Move" // 需要在指定节点上建立缓存
ActionLoad FileScheduleAction = "Load" // 需要加载到Storage
ActionImportImage FileScheduleAction = "ImportImage" // 需要导入镜像
)
type FileScheduleScheme struct {
Action FileScheduleAction `json:"action"`
}
// 任务调度方案
type JobScheduleScheme struct {
TargetCCID schsdk.CCID `json:"targetCCID"`
Dataset FileScheduleScheme `json:"dataset"`
Code FileScheduleScheme `json:"code"`
Image FileScheduleScheme `json:"image"`
}
// 任务集的预调度方案
type JobSetPreScheduleScheme struct {
JobSchemes map[string]JobScheduleScheme `json:"jobSchemes"` // 任务的预调度方案。Key为LocalJobID
}
type JobFiles struct {
Dataset PackageJobFile `json:"dataset"`
Code PackageJobFile `json:"code"`
Image ImageJobFile `json:"image"`
}
type PackageJobFile struct {
PackageID cdssdk.PackageID `json:"packageID"`
PackagePath string `json:"packagePath"` // Load之后的文件路径一个相对路径需要加上CDS数据库中的RemoteBase才是完整路径
ECSInstanceID schsdk.ECSInstanceID // TODO 这个实例ID暂时放在这里后续会修改
}
type ImageJobFile struct {
PackageID *cdssdk.PackageID `json:"packageID"`
ImageID schsdk.ImageID `json:"imageID"`
}
// 导出的任务的状态,需要能被序列化
type JobDump struct {
JobID schsdk.JobID `json:"jobID"`
JobSetID schsdk.JobSetID `json:"jobSetID"`
Info schsdk.JobInfo `json:"info"`
Body JobBodyDump `json:"body"`
State JobStateDump `json:"state"`
}