Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/2584 Reviewed-by: chenshihai <chenshh@pcl.ac.cn>pull/2590/head
@@ -137,6 +137,8 @@ type Cloudbrain struct { | |||
Type int `xorm:"INDEX"` | |||
BenchmarkTypeID int | |||
BenchmarkChildTypeID int | |||
CardType string | |||
Cluster string | |||
VersionID int64 //版本id | |||
VersionName string `xorm:"INDEX"` //当前版本 | |||
@@ -1927,7 +1929,8 @@ func CloudbrainAll(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { | |||
} | |||
if (opts.IsLatestVersion) != "" { | |||
cond = cond.And(builder.Or(builder.And(builder.Eq{"cloudbrain.is_latest_version": opts.IsLatestVersion}, builder.Eq{"cloudbrain.job_type": "TRAIN"}), builder.Neq{"cloudbrain.job_type": "TRAIN"})) | |||
cond = cond.And(builder.Or(builder.And(builder.Eq{"cloudbrain.is_latest_version": opts.IsLatestVersion}, | |||
builder.Eq{"cloudbrain.job_type": "TRAIN"}), builder.Neq{"cloudbrain.job_type": "TRAIN"})) | |||
} | |||
if len(opts.CloudbrainIDs) > 0 { | |||
@@ -1965,7 +1968,8 @@ func CloudbrainAll(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { | |||
} else { | |||
lowerKeyWord := strings.ToLower(opts.Keyword) | |||
cond = cond.And(builder.Or(builder.Like{"LOWER(cloudbrain.job_name)", lowerKeyWord}, builder.Like{"LOWER(cloudbrain.display_job_name)", lowerKeyWord}, builder.Like{"`user`.lower_name", lowerKeyWord})) | |||
cond = cond.And(builder.Or(builder.Like{"LOWER(cloudbrain.job_name)", lowerKeyWord}, | |||
builder.Like{"LOWER(cloudbrain.display_job_name)", lowerKeyWord}, builder.Like{"`user`.lower_name", lowerKeyWord})) | |||
count, err = sess.Table(&Cloudbrain{}).Unscoped().Where(cond). | |||
Join("left", "`user`", condition).Count(new(CloudbrainInfo)) | |||
@@ -2043,7 +2047,8 @@ func CloudbrainAllStatic(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, er | |||
} | |||
sess.OrderBy("cloudbrain.created_unix DESC") | |||
cloudbrains := make([]*CloudbrainInfo, 0, setting.UI.IssuePagingNum) | |||
if err := sess.Cols("status", "type", "job_type", "train_job_duration", "duration", "compute_resource", "created_unix", "start_time", "end_time").Table(&Cloudbrain{}).Unscoped().Where(cond). | |||
if err := sess.Cols("status", "type", "job_type", "train_job_duration", "duration", "compute_resource", | |||
"created_unix", "start_time", "end_time").Table(&Cloudbrain{}).Unscoped().Where(cond). | |||
Find(&cloudbrains); err != nil { | |||
return nil, 0, fmt.Errorf("Find: %v", err) | |||
} | |||
@@ -2098,6 +2103,90 @@ func GetDatasetInfo(uuidStr string) (map[string]DatasetInfo, string, error) { | |||
return datasetInfos, datasetNames, nil | |||
} | |||
var ( | |||
SpecsMapInitFlag = false | |||
CloudbrainDebugResourceSpecsMap map[int]*ResourceSpec | |||
CloudbrainTrainResourceSpecsMap map[int]*ResourceSpec | |||
CloudbrainInferenceResourceSpecsMap map[int]*ResourceSpec | |||
CloudbrainBenchmarkResourceSpecsMap map[int]*ResourceSpec | |||
GpuInfosMapInitFlag = false | |||
CloudbrainDebugGpuInfosMap map[string]*GpuInfo | |||
CloudbrainTrainGpuInfosMap map[string]*GpuInfo | |||
CloudbrainInferenceGpuInfosMap map[string]*GpuInfo | |||
CloudbrainBenchmarkGpuInfosMap map[string]*GpuInfo | |||
) | |||
func InitCloudbrainOneResourceSpecMap() { | |||
if CloudbrainDebugResourceSpecsMap == nil || len(CloudbrainDebugResourceSpecsMap) == 0 { | |||
t := ResourceSpecs{} | |||
json.Unmarshal([]byte(setting.ResourceSpecs), &t) | |||
CloudbrainDebugResourceSpecsMap = make(map[int]*ResourceSpec, len(t.ResourceSpec)) | |||
for _, spec := range t.ResourceSpec { | |||
CloudbrainDebugResourceSpecsMap[spec.Id] = spec | |||
} | |||
} | |||
if CloudbrainTrainResourceSpecsMap == nil || len(CloudbrainTrainResourceSpecsMap) == 0 { | |||
t := ResourceSpecs{} | |||
json.Unmarshal([]byte(setting.TrainResourceSpecs), &t) | |||
CloudbrainTrainResourceSpecsMap = make(map[int]*ResourceSpec, len(t.ResourceSpec)) | |||
for _, spec := range t.ResourceSpec { | |||
CloudbrainTrainResourceSpecsMap[spec.Id] = spec | |||
} | |||
} | |||
if CloudbrainInferenceResourceSpecsMap == nil || len(CloudbrainInferenceResourceSpecsMap) == 0 { | |||
t := ResourceSpecs{} | |||
json.Unmarshal([]byte(setting.InferenceResourceSpecs), &t) | |||
CloudbrainInferenceResourceSpecsMap = make(map[int]*ResourceSpec, len(t.ResourceSpec)) | |||
for _, spec := range t.ResourceSpec { | |||
CloudbrainInferenceResourceSpecsMap[spec.Id] = spec | |||
} | |||
} | |||
if CloudbrainBenchmarkResourceSpecsMap == nil || len(CloudbrainBenchmarkResourceSpecsMap) == 0 { | |||
t := ResourceSpecs{} | |||
json.Unmarshal([]byte(setting.BenchmarkResourceSpecs), &t) | |||
CloudbrainBenchmarkResourceSpecsMap = make(map[int]*ResourceSpec, len(t.ResourceSpec)) | |||
for _, spec := range t.ResourceSpec { | |||
CloudbrainBenchmarkResourceSpecsMap[spec.Id] = spec | |||
} | |||
} | |||
SpecsMapInitFlag = true | |||
} | |||
func InitCloudbrainOneGpuInfoMap() { | |||
if CloudbrainDebugGpuInfosMap == nil || len(CloudbrainDebugGpuInfosMap) == 0 { | |||
t := GpuInfos{} | |||
json.Unmarshal([]byte(setting.GpuTypes), &t) | |||
CloudbrainDebugGpuInfosMap = make(map[string]*GpuInfo, len(t.GpuInfo)) | |||
for _, GpuInfo := range t.GpuInfo { | |||
CloudbrainDebugGpuInfosMap[GpuInfo.Queue] = GpuInfo | |||
} | |||
} | |||
if CloudbrainTrainGpuInfosMap == nil || len(CloudbrainTrainGpuInfosMap) == 0 { | |||
t := GpuInfos{} | |||
json.Unmarshal([]byte(setting.TrainGpuTypes), &t) | |||
CloudbrainTrainGpuInfosMap = make(map[string]*GpuInfo, len(t.GpuInfo)) | |||
for _, GpuInfo := range t.GpuInfo { | |||
CloudbrainTrainGpuInfosMap[GpuInfo.Queue] = GpuInfo | |||
} | |||
} | |||
if CloudbrainInferenceGpuInfosMap == nil || len(CloudbrainInferenceGpuInfosMap) == 0 { | |||
t := GpuInfos{} | |||
json.Unmarshal([]byte(setting.InferenceGpuTypes), &t) | |||
CloudbrainInferenceGpuInfosMap = make(map[string]*GpuInfo, len(t.GpuInfo)) | |||
for _, GpuInfo := range t.GpuInfo { | |||
CloudbrainInferenceGpuInfosMap[GpuInfo.Queue] = GpuInfo | |||
} | |||
} | |||
if CloudbrainBenchmarkGpuInfosMap == nil || len(CloudbrainBenchmarkGpuInfosMap) == 0 { | |||
t := GpuInfos{} | |||
json.Unmarshal([]byte(setting.BenchmarkGpuTypes), &t) | |||
CloudbrainBenchmarkGpuInfosMap = make(map[string]*GpuInfo, len(t.GpuInfo)) | |||
for _, GpuInfo := range t.GpuInfo { | |||
CloudbrainBenchmarkGpuInfosMap[GpuInfo.Queue] = GpuInfo | |||
} | |||
} | |||
GpuInfosMapInitFlag = true | |||
} | |||
func GetNewestJobsByAiCenter() ([]int64, error) { | |||
ids := make([]int64, 0) | |||
return ids, x. | |||
@@ -29,6 +29,11 @@ type TaskDetail struct { | |||
RepoAlias string `json:"RepoAlias"` | |||
RepoID int64 `json:"RepoID"` | |||
IsDelete bool `json:"IsDelete"` | |||
CardNum int `json:"CardNum"` | |||
CardType string `json:"CardType"` | |||
CardDuration string `json:"CardDuration"` | |||
AiCenter string `json:"AiCenter"` | |||
FlavorName string `json:"FlavorName"` | |||
} | |||
func GetDebugOnePeriodCount(beginTime time.Time, endTime time.Time) (int64, error) { | |||
@@ -1098,6 +1098,9 @@ modelarts.createtime=CreateTime | |||
modelarts.version_nums = Version Nums | |||
modelarts.version = Version | |||
modelarts.computing_resources=compute Resources | |||
modelarts.ai_center=Ai Center | |||
modelarts.card_type=Card Type | |||
modelarts.cluster=Cluster | |||
modelarts.notebook=Debug Task | |||
modelarts.train_job=Train Task | |||
modelarts.train_job.new_debug= New Debug Task | |||
@@ -1108,6 +1108,9 @@ modelarts.deletetime=删除时间 | |||
modelarts.version_nums=版本数 | |||
modelarts.version=版本 | |||
modelarts.computing_resources=计算资源 | |||
modelarts.ai_center=智算中心 | |||
modelarts.card_type=卡类型 | |||
modelarts.cluster=集群 | |||
modelarts.notebook=调试任务 | |||
modelarts.train_job=训练任务 | |||
modelarts.train_job.new_debug=新建调试任务 | |||
@@ -3119,6 +3122,8 @@ select_dataset = 选择数据集 | |||
specification = 规格 | |||
select_specification = 选择资源规格 | |||
description = 描述 | |||
card_duration = 运行卡时 | |||
card_type = 卡类型 | |||
wrong_specification=您目前不能使用这个资源规格,请选择其他资源规格。 | |||
job_name_rule = 请输入字母、数字、_和-,最长64个字符,且不能以中划线(-)结尾。 | |||
@@ -10,6 +10,7 @@ import ( | |||
"github.com/360EntSecGroup-Skylar/excelize/v2" | |||
"code.gitea.io/gitea/modules/modelarts" | |||
"code.gitea.io/gitea/routers/repo" | |||
"code.gitea.io/gitea/models" | |||
"code.gitea.io/gitea/modules/base" | |||
@@ -89,6 +90,10 @@ func CloudBrains(ctx *context.Context) { | |||
ciTasks[i].CanDebug = true | |||
ciTasks[i].CanDel = true | |||
ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource | |||
ciTasks[i].Cloudbrain.AiCenter = repo.GetCloudbrainAiCenter(task.Cloudbrain, ctx) | |||
_, cardType, _ := repo.GetCloudbrainCardNumAndType(task.Cloudbrain) | |||
ciTasks[i].Cloudbrain.CardType = cardType | |||
ciTasks[i].Cloudbrain.Cluster = repo.GetCloudbrainCluster(task.Cloudbrain, ctx) | |||
} | |||
pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, getTotalPage(count, setting.UI.IssuePagingNum)) | |||
@@ -188,11 +193,19 @@ func DownloadCloudBrains(ctx *context.Context) { | |||
} | |||
func allValues(row int, rs *models.CloudbrainInfo, ctx *context.Context) map[string]string { | |||
return map[string]string{getCellName("A", row): rs.DisplayJobName, getCellName("B", row): rs.JobType, getCellName("C", row): rs.Status, getCellName("D", row): time.Unix(int64(rs.Cloudbrain.CreatedUnix), 0).Format(CREATE_TIME_FORMAT), getCellName("E", row): getDurationTime(rs), | |||
getCellName("F", row): rs.ComputeResource, getCellName("G", row): rs.Name, getCellName("H", row): getRepoPathName(rs), getCellName("I", row): rs.JobName, | |||
return map[string]string{getCellName("A", row): rs.DisplayJobName, getCellName("B", row): repo.GetCloudbrainCluster(rs.Cloudbrain, ctx), | |||
getCellName("C", row): rs.JobType, getCellName("D", row): rs.Status, getCellName("E", row): time.Unix(int64(rs.Cloudbrain.CreatedUnix), 0).Format(CREATE_TIME_FORMAT), | |||
getCellName("F", row): getDurationTime(rs), getCellName("G", row): rs.ComputeResource, | |||
getCellName("H", row): repo.GetCloudbrainAiCenter(rs.Cloudbrain, ctx), getCellName("I", row): getCloudbrainCardType(rs), | |||
getCellName("J", row): rs.Name, getCellName("K", row): getRepoPathName(rs), getCellName("L", row): rs.JobName, | |||
} | |||
} | |||
func getCloudbrainCardType(rs *models.CloudbrainInfo) string { | |||
_, cardType, _ := repo.GetCloudbrainCardNumAndType(rs.Cloudbrain) | |||
return cardType | |||
} | |||
func getRepoPathName(rs *models.CloudbrainInfo) string { | |||
if rs.Repo != nil { | |||
return rs.Repo.OwnerName + "/" + rs.Repo.Alias | |||
@@ -225,7 +238,11 @@ func getTotalPage(total int64, pageSize int) int { | |||
func allHeader(ctx *context.Context) map[string]string { | |||
return map[string]string{"A1": ctx.Tr("repo.cloudbrain_task"), "B1": ctx.Tr("repo.cloudbrain_task_type"), "C1": ctx.Tr("repo.modelarts.status"), "D1": ctx.Tr("repo.modelarts.createtime"), "E1": ctx.Tr("repo.modelarts.train_job.dura_time"), "F1": ctx.Tr("repo.modelarts.computing_resources"), "G1": ctx.Tr("repo.cloudbrain_creator"), "H1": ctx.Tr("repo.repo_name"), "I1": ctx.Tr("repo.cloudbrain_task_name")} | |||
return map[string]string{"A1": ctx.Tr("repo.cloudbrain_task"), "B1": ctx.Tr("repo.modelarts.cluster"), | |||
"C1": ctx.Tr("repo.cloudbrain_task_type"), "D1": ctx.Tr("repo.modelarts.status"), "E1": ctx.Tr("repo.modelarts.createtime"), | |||
"F1": ctx.Tr("repo.modelarts.train_job.dura_time"), "G1": ctx.Tr("repo.modelarts.computing_resources"), | |||
"H1": ctx.Tr("repo.modelarts.ai_center"), "I1": ctx.Tr("repo.modelarts.card_type"), "J1": ctx.Tr("repo.cloudbrain_creator"), | |||
"K1": ctx.Tr("repo.repo_name"), "L1": ctx.Tr("repo.cloudbrain_task_name")} | |||
} | |||
@@ -10,6 +10,7 @@ import ( | |||
"code.gitea.io/gitea/models" | |||
"code.gitea.io/gitea/modules/context" | |||
"code.gitea.io/gitea/modules/log" | |||
"code.gitea.io/gitea/routers/repo" | |||
"github.com/360EntSecGroup-Skylar/excelize/v2" | |||
) | |||
@@ -751,43 +752,12 @@ func GetCloudbrainsDetailData(ctx *context.Context) { | |||
taskDetail.RepoName = ciTasks[i].Repo.OwnerName + "/" + ciTasks[i].Repo.Name | |||
taskDetail.RepoAlias = ciTasks[i].Repo.OwnerName + "/" + ciTasks[i].Repo.Alias | |||
} | |||
if ciTasks[i].Cloudbrain.Status == string(models.JobWaiting) { | |||
if ciTasks[i].Cloudbrain.DeletedAt != nilTime { | |||
WaitTimeInt := ciTasks[i].Cloudbrain.UpdatedUnix.AsTime().Unix() - ciTasks[i].Cloudbrain.CreatedUnix.AsTime().Unix() | |||
taskDetail.WaitTime = models.ConvertDurationToStr(WaitTimeInt) | |||
if WaitTimeInt < 0 { | |||
taskDetail.WaitTime = "00:00:00" | |||
} | |||
} else { | |||
if ciTasks[i].Cloudbrain.StartTime.AsTime().Unix() == 0 { | |||
WaitTimeInt := time.Now().Unix() - ciTasks[i].Cloudbrain.CreatedUnix.AsTime().Unix() | |||
taskDetail.WaitTime = models.ConvertDurationToStr(WaitTimeInt) | |||
if WaitTimeInt < 0 { | |||
taskDetail.WaitTime = "00:00:00" | |||
} | |||
} else { | |||
WaitTimeInt := ciTasks[i].Cloudbrain.StartTime.AsTime().Unix() - ciTasks[i].Cloudbrain.CreatedUnix.AsTime().Unix() | |||
taskDetail.WaitTime = models.ConvertDurationToStr(WaitTimeInt) | |||
if WaitTimeInt < 0 { | |||
taskDetail.WaitTime = "00:00:00" | |||
} | |||
} | |||
} | |||
} else if ciTasks[i].Cloudbrain.Status == string(models.JobStopped) && ciTasks[i].Cloudbrain.StartTime.AsTime().Unix() == 0 { | |||
WaitTimeInt := ciTasks[i].Cloudbrain.EndTime.AsTime().Unix() - ciTasks[i].Cloudbrain.CreatedUnix.AsTime().Unix() | |||
taskDetail.WaitTime = models.ConvertDurationToStr(WaitTimeInt) | |||
if WaitTimeInt < 0 { | |||
taskDetail.WaitTime = "00:00:00" | |||
} | |||
} else { | |||
WaitTimeInt := ciTasks[i].Cloudbrain.StartTime.AsTime().Unix() - ciTasks[i].Cloudbrain.CreatedUnix.AsTime().Unix() | |||
taskDetail.WaitTime = models.ConvertDurationToStr(WaitTimeInt) | |||
if WaitTimeInt < 0 { | |||
taskDetail.WaitTime = "00:00:00" | |||
} | |||
} | |||
taskDetail.CardNum, taskDetail.CardType, _ = repo.GetCloudbrainCardNumAndType(ciTasks[i].Cloudbrain) | |||
taskDetail.CardDuration = repo.GetCloudbrainCardDuration(ciTasks[i].Cloudbrain) | |||
taskDetail.AiCenter = repo.GetCloudbrainAiCenter(ciTasks[i].Cloudbrain, ctx) | |||
taskDetail.FlavorName, _ = repo.GetCloudbrainFlavorName(ciTasks[i].Cloudbrain) | |||
taskDetail.WaitTime = repo.GetCloudbrainWaitTime(ciTasks[i].Cloudbrain) | |||
if ciTasks[i].Cloudbrain.Type == models.TypeCloudBrainTwo || (ciTasks[i].Cloudbrain.Type == models.TypeCloudBrainOne && ciTasks[i].Cloudbrain.JobType == "TRAIN") { | |||
taskDetail.JobID = ciTasks[i].Cloudbrain.JobID | |||
} | |||
@@ -813,6 +783,17 @@ func GetCloudbrainsDetailData(ctx *context.Context) { | |||
}) | |||
} | |||
func getCloudbrainAiCenter(task models.Cloudbrain, ctx *context.Context) string { | |||
if task.Type == models.TypeCloudBrainOne { | |||
return ctx.Tr("repo.cloudbrain1") | |||
} else if task.Type == models.TypeCloudBrainTwo { | |||
return ctx.Tr("repo.cloudbrain2") | |||
} else if task.Type == models.TypeC2Net { | |||
return task.AiCenter | |||
} | |||
return "" | |||
} | |||
func GetCloudbrainsCreateHoursData(ctx *context.Context) { | |||
recordCloudbrain, err := models.GetRecordBeginTime() | |||
if err != nil { | |||
@@ -1247,18 +1228,23 @@ func allCloudbrainHeader(ctx *context.Context) map[string]string { | |||
return map[string]string{"A1": ctx.Tr("repo.cloudbrain_task"), "B1": ctx.Tr("repo.cloudbrain_type"), "C1": ctx.Tr("repo.modelarts.status"), "D1": ctx.Tr("repo.cloudbrain_task_type"), | |||
"E1": ctx.Tr("repo.modelarts.createtime"), "F1": ctx.Tr("repo.modelarts.train_job.wait_time"), "G1": ctx.Tr("repo.modelarts.train_job.dura_time"), | |||
"H1": ctx.Tr("repo.modelarts.train_job.start_time"), | |||
"I1": ctx.Tr("repo.modelarts.train_job.end_time"), "J1": ctx.Tr("repo.modelarts.computing_resources"), | |||
"K1": ctx.Tr("repo.cloudbrain_creator"), "L1": ctx.Tr("repo.repo_name"), "M1": ctx.Tr("repo.cloudbrain_task_name"), "N1": ctx.Tr("repo.modelarts.deletetime")} | |||
"H1": ctx.Tr("cloudbrain.card_duration"), | |||
"I1": ctx.Tr("repo.modelarts.train_job.start_time"), "J1": ctx.Tr("repo.modelarts.train_job.end_time"), | |||
"K1": ctx.Tr("repo.modelarts.computing_resources"), "L1": ctx.Tr("cloudbrain.card_type"), | |||
"M1": ctx.Tr("repo.grampus.train_job.ai_center"), "N1": ctx.Tr("cloudbrain.resource_specification"), | |||
"O1": ctx.Tr("repo.cloudbrain_creator"), "P1": ctx.Tr("repo.repo_name"), "Q1": ctx.Tr("repo.cloudbrain_task_name"), | |||
"R1": ctx.Tr("repo.modelarts.deletetime")} | |||
} | |||
func allCloudbrainValues(row int, rs *models.CloudbrainInfo, ctx *context.Context) map[string]string { | |||
return map[string]string{getCellName("A", row): rs.DisplayJobName, getCellName("B", row): getCloudbrainType(rs, ctx), getCellName("C", row): rs.Status, getCellName("D", row): rs.JobType, | |||
getCellName("E", row): time.Unix(int64(rs.Cloudbrain.CreatedUnix), 0).Format(CREATE_TIME_FORMAT), getCellName("F", row): getBrainWaitTime(rs), | |||
getCellName("G", row): rs.TrainJobDuration, getCellName("H", row): getBrainStartTime(rs), | |||
getCellName("I", row): getBrainEndTime(rs), | |||
getCellName("J", row): rs.ComputeResource, getCellName("K", row): rs.Name, getCellName("L", row): getBrainRepo(rs), | |||
getCellName("M", row): rs.JobName, getCellName("N", row): getBrainDeleteTime(rs), | |||
getCellName("E", row): time.Unix(int64(rs.Cloudbrain.CreatedUnix), 0).Format(CREATE_TIME_FORMAT), getCellName("F", row): repo.GetCloudbrainWaitTime(rs.Cloudbrain), | |||
getCellName("G", row): rs.TrainJobDuration, getCellName("H", row): repo.GetCloudbrainCardDuration(rs.Cloudbrain), | |||
getCellName("I", row): getBrainStartTime(rs), | |||
getCellName("J", row): getBrainEndTime(rs), getCellName("K", row): rs.ComputeResource, getCellName("L", row): getCloudbrainCardType(rs), | |||
getCellName("M", row): repo.GetCloudbrainAiCenter(rs.Cloudbrain, ctx), getCellName("N", row): getCloudbrainFlavorName(rs), | |||
getCellName("O", row): rs.Name, getCellName("P", row): getBrainRepo(rs), | |||
getCellName("Q", row): rs.JobName, getCellName("R", row): getBrainDeleteTime(rs), | |||
} | |||
} | |||
func getBrainRepo(rs *models.CloudbrainInfo) string { | |||
@@ -1285,19 +1271,6 @@ func getBrainEndTime(rs *models.CloudbrainInfo) string { | |||
} | |||
} | |||
func getBrainWaitTime(rs *models.CloudbrainInfo) string { | |||
var waitTime int64 | |||
if rs.Cloudbrain.Status == string(models.JobWaiting) { | |||
waitTime = time.Now().Unix() - rs.Cloudbrain.CreatedUnix.AsTime().Unix() | |||
} else { | |||
waitTime = int64(rs.Cloudbrain.StartTime - rs.Cloudbrain.CreatedUnix) | |||
} | |||
if waitTime <= 0 { | |||
return "00:00:00" | |||
} else { | |||
return models.ConvertDurationToStr(waitTime) | |||
} | |||
} | |||
func getCloudbrainType(rs *models.CloudbrainInfo, ctx *context.Context) string { | |||
if rs.Cloudbrain.Type == models.TypeCloudBrainOne { | |||
return ctx.Tr("repo.cloudbrain1") | |||
@@ -1309,6 +1282,14 @@ func getCloudbrainType(rs *models.CloudbrainInfo, ctx *context.Context) string { | |||
return ctx.Tr("repo.cloudbrain_untype") | |||
} | |||
} | |||
func getCloudbrainCardType(rs *models.CloudbrainInfo) string { | |||
_, cardType, _ := repo.GetCloudbrainCardNumAndType(rs.Cloudbrain) | |||
return cardType | |||
} | |||
func getCloudbrainFlavorName(rs *models.CloudbrainInfo) string { | |||
flavorName, _ := repo.GetCloudbrainFlavorName(rs.Cloudbrain) | |||
return flavorName | |||
} | |||
func getBrainDeleteTime(rs *models.CloudbrainInfo) string { | |||
nilTime := time.Time{} | |||
@@ -2973,3 +2973,142 @@ func GetBenchmarkTypes(ctx *context.Context) *models.BenchmarkTypes { | |||
} | |||
return benchmarkTypesMap[lang] | |||
} | |||
func GetCloudbrainAiCenter(task models.Cloudbrain, ctx *context.Context) string { | |||
if task.Type == models.TypeCloudBrainOne { | |||
return ctx.Tr("repo.cloudbrain1") | |||
} else if task.Type == models.TypeCloudBrainTwo { | |||
return ctx.Tr("repo.cloudbrain2") | |||
} else if task.Type == models.TypeC2Net { | |||
return task.AiCenter | |||
} | |||
return "" | |||
} | |||
func GetCloudbrainCluster(task models.Cloudbrain, ctx *context.Context) string { | |||
if task.Type == models.TypeCloudBrainOne || task.Type == models.TypeCloudBrainTwo { | |||
return ctx.Tr("cloudbrain.resource_cluster_openi") | |||
} else if task.Type == models.TypeC2Net { | |||
return ctx.Tr("cloudbrain.resource_cluster_c2net") | |||
} | |||
return "" | |||
} | |||
func GetCloudbrainCardDuration(task models.Cloudbrain) string { | |||
CardNum, _, _ := GetCloudbrainCardNumAndType(task) | |||
CardDuration := models.ConvertDurationToStr(int64(CardNum) * task.Duration) | |||
return CardDuration | |||
} | |||
func GetCloudbrainWaitTime(task models.Cloudbrain) string { | |||
var WaitTime string | |||
if task.Status == string(models.JobWaiting) { | |||
WaitTimeInt := time.Now().Unix() - task.CreatedUnix.AsTime().Unix() | |||
WaitTime = models.ConvertDurationToStr(WaitTimeInt) | |||
if WaitTimeInt < 0 { | |||
WaitTime = "00:00:00" | |||
} | |||
} else if task.Status == string(models.JobStopped) && task.StartTime.AsTime().Unix() == 0 { | |||
WaitTimeInt := task.EndTime.AsTime().Unix() - task.CreatedUnix.AsTime().Unix() | |||
WaitTime = models.ConvertDurationToStr(WaitTimeInt) | |||
if WaitTimeInt < 0 { | |||
WaitTime = "00:00:00" | |||
} | |||
} else { | |||
WaitTimeInt := task.StartTime.AsTime().Unix() - task.CreatedUnix.AsTime().Unix() | |||
WaitTime = models.ConvertDurationToStr(WaitTimeInt) | |||
if WaitTimeInt < 0 { | |||
WaitTime = "00:00:00" | |||
} | |||
} | |||
return WaitTime | |||
} | |||
func GetCloudbrainCardNumAndType(task models.Cloudbrain) (int, string, error) { | |||
if !models.SpecsMapInitFlag { | |||
models.InitCloudbrainOneResourceSpecMap() | |||
} | |||
if !models.GpuInfosMapInitFlag { | |||
models.InitCloudbrainOneGpuInfoMap() | |||
} | |||
FlavorName, err := GetCloudbrainFlavorName(task) | |||
if err != nil { | |||
return 0, "", nil | |||
} | |||
return getCardNumAndTypeByFlavorname(FlavorName) | |||
} | |||
func getCardNumAndTypeByFlavorname(FlavorName string) (int, string, error) { | |||
if FlavorName == "" { | |||
return 0, "", nil | |||
} else { | |||
var beginIndex = strings.Index(FlavorName, ":") | |||
var lastIndex = strings.LastIndex(FlavorName, ":") | |||
var endIndex = strings.Index(FlavorName, "*") | |||
if endIndex >= (beginIndex+1) && lastIndex >= (endIndex+1) { | |||
cardNum, err := strconv.Atoi(strings.TrimSpace(FlavorName[beginIndex+1 : endIndex])) | |||
if err != nil { | |||
log.Error("strconv.Atoi failed: %v", err) | |||
return 0, "", err | |||
} | |||
cardType := strings.TrimSpace(FlavorName[endIndex+1 : lastIndex]) | |||
return cardNum, cardType, err | |||
} | |||
return 0, "", nil | |||
} | |||
} | |||
func GetCloudbrainFlavorName(task models.Cloudbrain) (string, error) { | |||
if task.Type == models.TypeCloudBrainOne { | |||
ResourceSpec, GpuInfo, err := getCloudBrainOneResourceSpec(task) | |||
if err != nil { | |||
log.Info("getCloudBrainOneResourceSpec err:", err) | |||
return "", err | |||
} else { | |||
if ResourceSpec == nil || GpuInfo == nil { | |||
err := errors.New("ResourceSpec or GpuInfo is nil") | |||
return "", err | |||
} else { | |||
CloudbrainOneFlavorName := "GPU:" + strconv.Itoa(ResourceSpec.GpuNum) + "*Nvidia-" + GpuInfo.Value + | |||
" | CPU:" + strconv.Itoa(ResourceSpec.CpuNum) + "核" + strconv.Itoa(ResourceSpec.MemMiB) + "MB" | |||
return CloudbrainOneFlavorName, nil | |||
} | |||
} | |||
} else if (task.Type == models.TypeCloudBrainTwo || task.Type == models.TypeC2Net) && task.FlavorName != "" { | |||
ReplaceFlavorName := strings.ReplaceAll(task.FlavorName, ":", ":") | |||
return ReplaceFlavorName, nil | |||
} else if task.Type == models.TypeCloudBrainTwo && task.FlavorName == "" && task.FlavorCode != "" { | |||
index := strings.LastIndex(task.FlavorCode, ".") | |||
cardNum, err := strconv.Atoi(strings.TrimSpace(task.FlavorCode[index+1 : len(task.FlavorCode)])) | |||
if err != nil { | |||
log.Error("strconv.Atoi failed: %v", err) | |||
return "", err | |||
} | |||
CloudbrainTwoFlavorName := "Ascend:" + strings.TrimSpace(task.FlavorCode[index+1:len(task.FlavorCode)]) + | |||
"*Ascend-910(" + strconv.Itoa(cardNum*32) + "GB)|ARM:" + strconv.Itoa(cardNum*24) + | |||
"核" + strconv.Itoa(cardNum*256) + "GB" | |||
return CloudbrainTwoFlavorName, nil | |||
} | |||
return "", nil | |||
} | |||
func getCloudBrainOneResourceSpec(task models.Cloudbrain) (*models.ResourceSpec, *models.GpuInfo, error) { | |||
GpuQueueDefault := "openidebug" | |||
if task.GpuQueue != "" { | |||
GpuQueueDefault = task.GpuQueue | |||
} | |||
if task.ResourceSpecId >= 0 { | |||
if task.JobType == string(models.JobTypeTrain) { | |||
return models.CloudbrainTrainResourceSpecsMap[task.ResourceSpecId], models.CloudbrainTrainGpuInfosMap[GpuQueueDefault], nil | |||
} else if task.JobType == string(models.JobTypeDebug) { | |||
return models.CloudbrainDebugResourceSpecsMap[task.ResourceSpecId], models.CloudbrainDebugGpuInfosMap[GpuQueueDefault], nil | |||
} else if task.JobType == string(models.JobTypeInference) { | |||
return models.CloudbrainInferenceResourceSpecsMap[task.ResourceSpecId], models.CloudbrainInferenceGpuInfosMap[GpuQueueDefault], nil | |||
} else if task.JobType == string(models.JobTypeBenchmark) || task.JobType == string(models.JobTypeSnn4imagenet) || task.JobType == string(models.JobTypeBrainScore) { | |||
return models.CloudbrainBenchmarkResourceSpecsMap[task.ResourceSpecId], models.CloudbrainBenchmarkGpuInfosMap[GpuQueueDefault], nil | |||
} | |||
} else { | |||
err := errors.New("ResourceSpecId is null") | |||
return nil, nil, err | |||
} | |||
return nil, nil, nil | |||
} |
@@ -23,6 +23,7 @@ import ( | |||
"code.gitea.io/gitea/modules/modelarts" | |||
"code.gitea.io/gitea/modules/setting" | |||
"code.gitea.io/gitea/modules/util" | |||
"code.gitea.io/gitea/routers/repo" | |||
issue_service "code.gitea.io/gitea/services/issue" | |||
pull_service "code.gitea.io/gitea/services/pull" | |||
@@ -834,6 +835,11 @@ func Cloudbrains(ctx *context.Context) { | |||
ciTasks[i].CanDebug = true | |||
ciTasks[i].CanDel = true | |||
ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource | |||
ciTasks[i].Cloudbrain.AiCenter = repo.GetCloudbrainAiCenter(task.Cloudbrain, ctx) | |||
_, cardType, _ := repo.GetCloudbrainCardNumAndType(task.Cloudbrain) | |||
ciTasks[i].Cloudbrain.CardType = cardType | |||
ciTasks[i].Cloudbrain.Cluster = repo.GetCloudbrainCluster(task.Cloudbrain, ctx) | |||
} | |||
pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, getTotalPage(count, setting.UI.IssuePagingNum)) | |||
@@ -18,7 +18,7 @@ | |||
data-all-compute="{{.i18n.Tr "admin.cloudbrain.all_computing_resources"}}" | |||
data-all-status="{{.i18n.Tr "admin.cloudbrain.all_status"}}"></div> | |||
{{template "admin/navbar" .}} | |||
<div class="ui container" style="width: 80%;"> | |||
<div class="ui container" style="width: 95%;"> | |||
{{template "base/alert" .}} | |||
<div class="ui grid"> | |||
<div class="row" style="border: 1px solid #d4d4d5;margin-top: 15px;padding-top: 0;"> | |||
@@ -34,34 +34,46 @@ | |||
<!-- 表头 --> | |||
<div class="ui grid stackable" style="background: #f0f0f0;;"> | |||
<div class="row"> | |||
<div class="two wide column nowrap"> | |||
<span style="margin:0 6px">{{$.i18n.Tr "repo.cloudbrain_task"}}</span> | |||
<div class="two wide column nowrap" style="width:10% !important;"> | |||
<span>{{$.i18n.Tr "repo.cloudbrain_task"}}</span> | |||
</div> | |||
<div class="one wide column text center nowrap"> | |||
<span style="margin:0 6px">{{$.i18n.Tr "repo.cloudbrain_task_type"}}</span> | |||
<!-- 集群 --> | |||
<div class="one wide column text center nowrap" style="width:6% !important;"> | |||
<span>{{$.i18n.Tr "repo.modelarts.cluster"}}</span> | |||
</div> | |||
<div class="two wide column text center nowrap" style="width: 10% !important;"> | |||
<div class="one wide column text center nowrap" style="width:6% !important;"> | |||
<span>{{$.i18n.Tr "repo.cloudbrain_task_type"}}</span> | |||
</div> | |||
<div class="two wide column text center nowrap" style="width: 6% !important;"> | |||
<span>{{$.i18n.Tr "repo.modelarts.status"}}</span> | |||
</div> | |||
<div class="two wide column text center nowrap" style="width: 10% !important;"> | |||
<div class="two wide column text center nowrap" style="width: 8% !important;"> | |||
<span>{{$.i18n.Tr "repo.modelarts.createtime"}}</span> | |||
</div> | |||
<div class="one wide column text center nowrap"> | |||
<div class="one wide column text center nowrap" style="width: 5% !important;"> | |||
<span>{{$.i18n.Tr "repo.cloudbrain_status_runtime"}}</span> | |||
</div> | |||
<div class="one wide column text center nowrap"> | |||
<div class="one wide column text center nowrap" style="width: 5% !important;"> | |||
<span>{{$.i18n.Tr "repo.modelarts.computing_resources"}}</span> | |||
</div> | |||
<div class="one wide column text center nowrap"> | |||
<!-- 智算中心 --> | |||
<div class="one wide column text center nowrap" style="width:8% !important;"> | |||
<span>{{$.i18n.Tr "repo.modelarts.ai_center"}}</span> | |||
</div> | |||
<!-- XPU类型 --> | |||
<div class="one wide column text center nowrap" style="width:8% !important;"> | |||
<span>{{$.i18n.Tr "repo.modelarts.card_type"}}</span> | |||
</div> | |||
<div class="one wide column text center nowrap" style="width:4% !important;"> | |||
<span>{{$.i18n.Tr "repo.cloudbrain_creator"}}</span> | |||
</div> | |||
<div class="two wide column text center nowrap"> | |||
<div class="two wide column text center nowrap" style="width:10% !important;"> | |||
<span>{{$.i18n.Tr "repository"}}</span> | |||
</div> | |||
<div class="two wide column text center nowrap"> | |||
<div class="two wide column text center nowrap" style="width:10% !important;"> | |||
<span>{{.i18n.Tr "admin.cloudbrain.cloudbrain_name"}}</span> | |||
</div> | |||
<div class="two wide column text center nowrap" style="width: 17.5%!important;"> | |||
<div class="two wide column text center nowrap" style="width: 12%!important;"> | |||
<span>{{$.i18n.Tr "repo.cloudbrain_operate"}}</span> | |||
</div> | |||
</div> | |||
@@ -78,18 +90,18 @@ | |||
{{$JobID = .JobID}} | |||
{{end}} | |||
<!-- {{$JobID}} --> | |||
<div class="two wide column nowrap"> | |||
<div class="two wide column nowrap" style="width:10% !important;"> | |||
{{if eq .JobType "DEBUG"}} | |||
<a class="title" | |||
href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain/{{$JobID}}{{else}}/modelarts/notebook/{{$JobID}}{{end}}" | |||
title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||
<span class="fitted" | |||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
</a> | |||
{{else if or (eq .JobType "SNN4IMAGENET") (eq .JobType "BRAINSCORE")}} | |||
<a class="title" | |||
href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/cloudbrain/benchmark/{{$JobID}}" | |||
title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||
<span class="fitted" | |||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
</a> | |||
@@ -103,26 +115,27 @@ | |||
{{else if eq .JobType "TRAIN"}} | |||
<a class="title" | |||
href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .Cloudbrain.Type 0}}/cloudbrain{{else if eq .Cloudbrain.Type 1}}/modelarts{{else if eq .Cloudbrain.Type 2}}/grampus{{end}}/train-job/{{$JobID}}" | |||
title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||
<span class="fitted" | |||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
</a> | |||
{{else if eq .JobType "BENCHMARK"}} | |||
<a class="title" | |||
href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/cloudbrain/benchmark/{{$JobID}}" | |||
title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||
<span class="fitted" | |||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
</a> | |||
{{end}} | |||
</div> | |||
<!-- 任务类型 --> | |||
<div class="one wide column text center nowrap"> | |||
<span style="font-size: 12px;">{{.JobType}} </span> | |||
<!-- 集群 --> | |||
<div class="one wide column text center nowrap" style="width:6% !important;"> | |||
<span | |||
style="font-size: 12px;">{{if .Cluster}}{{.Cluster}}{{else}}--{{end}}</span> | |||
</div> | |||
<!-- 任务状态 --> | |||
<div class="two wide column text center nowrap" | |||
style="padding-left: 2.2rem !important; width: 10% !important;"> | |||
style="width: 6% !important;"> | |||
<span class="job-status" id="{{$JobID}}" | |||
data-repopath='{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .JobType "DEBUG"}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}{{else if eq .JobType "INFERENCE"}}/modelarts/inference-job{{else if eq .JobType "TRAIN"}}/modelarts/train-job{{else if eq .JobType "BENCHMARK"}}/cloudbrain{{end}}' | |||
data-jobid="{{$JobID}}" data-version="{{.VersionName}}"> | |||
@@ -131,23 +144,39 @@ | |||
style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span> | |||
</span> | |||
</div> | |||
<!-- 任务类型 --> | |||
<div class="one wide column text center nowrap" style="width: 6% !important;"> | |||
<span style="font-size: 12px;">{{.JobType}} </span> | |||
</div> | |||
<!-- 任务创建时间 --> | |||
<div class="two wide column text center nowrap" style="width: 10% !important;"> | |||
<div class="two wide column text center nowrap" style="width: 8% !important;"> | |||
<span style="font-size: 12px;" | |||
class="">{{TimeSinceUnix1 .Cloudbrain.CreatedUnix}}</span> | |||
</div> | |||
<!-- 任务运行时间 --> | |||
<div class="one wide column text center nowrap"> | |||
<div class="one wide column text center nowrap" style="width: 5% !important;"> | |||
<span style="font-size: 12px;" | |||
id="duration-{{$JobID}}">{{if .TrainJobDuration}}{{.TrainJobDuration}}{{else}}--{{end}}</span> | |||
</div> | |||
<!-- 计算资源 --> | |||
<div class="one wide column text center nowrap"> | |||
<div class="one wide column text center nowrap" style="width: 5% !important;"> | |||
<span | |||
style="font-size: 12px;">{{if .ComputeResource}}{{.ComputeResource}}{{else}}--{{end}}</span> | |||
</div> | |||
<!-- 智算中心 --> | |||
<div class="one wide column text center nowrap" style="width:8% !important;"> | |||
<span | |||
style="font-size: 12px;">{{if .AiCenter}}{{.AiCenter}}{{else}}--{{end}}</span> | |||
</div> | |||
<!-- XPU类型 --> | |||
<div class="one wide column text center nowrap" style="width:8% !important;"> | |||
<span style="font-size: 12px;" title="{{.CardType}}"> | |||
{{if .CardType}}{{.CardType}}{{else}}--{{end}} | |||
</span> | |||
</div> | |||
<!-- 创建者 --> | |||
<div class="one wide column text center nowrap"> | |||
<div class="one wide column text center nowrap" style="width:4% !important;"> | |||
{{if .User.Name}} | |||
<a href="{{AppSubUrl}}/{{.User.Name}}" title="{{.User.Name}}"><img | |||
class="ui avatar image" src="{{.User.RelAvatarLink}}"></a> | |||
@@ -157,16 +186,24 @@ | |||
{{end}} | |||
</div> | |||
<!-- 项目 --> | |||
<div class="two wide column text center nowrap"> | |||
<div class="two wide column text center nowrap" style="width:10% !important;"> | |||
<a href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}" | |||
title="{{.Repo.OwnerName}}/{{.Repo.Alias}}">{{.Repo.OwnerName}}/{{.Repo.Alias}}</a> | |||
</div> | |||
<!-- 云脑侧名称 --> | |||
<div class="two wide column text center nowrap" | |||
style="overflow: hidden;text-overflow:ellipsis;"> | |||
<span class="fitted" title="{{.JobName}}">{{.JobName}}</span> | |||
style="overflow: hidden;text-overflow:ellipsis;width:10% !important;"> | |||
<span class="ui poping up clipboard" data-position="top center" id="clipboard-btn" style="cursor:pointer" | |||
data-clipboard-text="{{.JobName}}" | |||
data-success="{{$.i18n.Tr "repo.copy_link_success"}}" | |||
data-error="{{$.i18n.Tr "repo.copy_link_error"}}" | |||
data-content="{{$.i18n.Tr "repo.copy_link"}}" | |||
data-variation="inverted tiny" | |||
> | |||
<span class="fitted" title="{{.JobName}}">{{.JobName}}</span> | |||
</span> | |||
</div> | |||
<div class="two wide column text center nowrap" style="width: 17.5%!important;"> | |||
<div class="two wide column text center nowrap" style="width: 14%!important;"> | |||
{{if eq .JobType "DEBUG"}} | |||
<div class="ui compact buttons"> | |||
<form id="debugAgainForm-{{$JobID}}"> | |||
@@ -235,36 +272,37 @@ | |||
<div class="ui grid stackable item"> | |||
<div class="row"> | |||
<!-- 任务名 --> | |||
<div class="two wide column nowrap"> | |||
<div class="two wide column nowrap" style="width:10% !important;"> | |||
{{if eq .JobType "DEBUG"}} | |||
<a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
<a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||
<span class="fitted" | |||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
</a> | |||
{{else if eq .JobType "INFERENCE"}} | |||
<a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
<a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||
<span class="fitted" | |||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
</a> | |||
{{else if eq .JobType "TRAIN"}} | |||
<a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
<a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||
<span class="fitted" | |||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
</a> | |||
{{else if eq .JobType "BENCHMARK"}} | |||
<a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
<a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||
<span class="fitted" | |||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
</a> | |||
{{end}} | |||
</div> | |||
<!-- 任务类型 --> | |||
<div class="one wide column text center nowrap"> | |||
<span style="font-size: 12px;">{{.JobType}} </span> | |||
<!-- 集群 --> | |||
<div class="one wide column text center nowrap" style="width:6% !important;"> | |||
<span | |||
style="font-size: 12px;">{{if .Cluster}}{{.Cluster}}{{else}}--{{end}}</span> | |||
</div> | |||
<!-- 任务状态 --> | |||
<div class="two wide column text center nowrap" | |||
style="padding-left: 2.2rem !important; width: 10% !important;"> | |||
style="width: 6% !important;"> | |||
<span class="job-status" id="{{$JobID}}" data-jobid="{{$JobID}}" | |||
data-version="{{.VersionName}}"> | |||
<span><i id="{{$JobID}}-icon" style="vertical-align: middle;" | |||
@@ -272,23 +310,39 @@ | |||
style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span> | |||
</span> | |||
</div> | |||
<!-- 任务类型 --> | |||
<div class="one wide column text center nowrap" style="width:6% !important;"> | |||
<span style="font-size: 12px;">{{.JobType}} </span> | |||
</div> | |||
<!-- 任务创建时间 --> | |||
<div class="two wide column text center nowrap" style="width: 10% !important;"> | |||
<div class="two wide column text center nowrap" style="width: 8% !important;"> | |||
<span style="font-size: 12px;" | |||
class="">{{TimeSinceUnix1 .Cloudbrain.CreatedUnix}}</span> | |||
</div> | |||
<!-- 任务运行时间 --> | |||
<div class="one wide column text center nowrap"> | |||
<div class="one wide column text center nowrap" style="width:5% !important;"> | |||
<span style="font-size: 12px;" | |||
id="duration-{{$JobID}}">{{if .TrainJobDuration}}{{.TrainJobDuration}}{{else}}--{{end}}</span> | |||
</div> | |||
<!-- 计算资源 --> | |||
<div class="one wide column text center nowrap"> | |||
<div class="one wide column text center nowrap" style="width:5% !important;"> | |||
<span | |||
style="font-size: 12px;">{{if .ComputeResource}}{{.ComputeResource}}{{else}}--{{end}}</span> | |||
</div> | |||
<!-- 智算中心 --> | |||
<div class="one wide column text center nowrap" style="width:8% !important;"> | |||
<span | |||
style="font-size: 12px;">{{if .AiCenter}}{{.AiCenter}}{{else}}--{{end}}</span> | |||
</div> | |||
<!-- XPU类型 --> | |||
<div class="one wide column text center nowrap" style="width:8% !important;"> | |||
<span style="font-size: 12px;" title="{{.CardType}}"> | |||
{{if .CardType}}{{.CardType}}{{else}}--{{end}} | |||
</span> | |||
</div> | |||
<!-- 创建者 --> | |||
<div class="one wide column text center nowrap"> | |||
<div class="one wide column text center nowrap" style="width:4% !important;"> | |||
{{if .User.Name}} | |||
<a href="{{AppSubUrl}}/{{.User.Name}}" title="{{.User.Name}}"><img | |||
class="ui avatar image" src="{{.User.RelAvatarLink}}"></a> | |||
@@ -298,15 +352,24 @@ | |||
{{end}} | |||
</div> | |||
<!-- 项目 --> | |||
<div class="two wide column text center nowrap"> | |||
<div class="two wide column text center nowrap" style="width:10% !important;"> | |||
<a href="" title="">--</a> | |||
</div> | |||
<!-- 云脑侧名称 --> | |||
<div class="two wide column text center nowrap" | |||
style="overflow: hidden;text-overflow:ellipsis;"> | |||
<span class="fitted">{{.JobName}}</span> | |||
style="overflow: hidden;text-overflow:ellipsis;width:10% !important;"> | |||
<span class="ui poping up clipboard" data-position="top center" id="clipboard-btn" style="cursor:pointer" | |||
data-clipboard-text="{{.JobName}}" | |||
data-success="{{$.i18n.Tr "repo.copy_link_success"}}" | |||
data-error="{{$.i18n.Tr "repo.copy_link_error"}}" | |||
data-content="{{$.i18n.Tr "repo.copy_link"}}" | |||
data-variation="inverted tiny" | |||
> | |||
<span class="fitted" title="{{.JobName}}">{{.JobName}}</span> | |||
</span> | |||
</div> | |||
<div class="two wide column text center nowrap" style="width: 17.5%!important;"> | |||
<div class="two wide column text center nowrap" style="width: 14%!important;"> | |||
{{if eq .JobType "DEBUG"}} | |||
<div class="ui compact buttons"> | |||
<form id="debugAgainForm-{{$JobID}}"> | |||
@@ -15,7 +15,7 @@ | |||
</div> | |||
</div> | |||
</div> | |||
<div class="ui container" style="width: 80%;"> | |||
<div class="ui container" style="width: 90%;"> | |||
<div class="ui grid"> | |||
<div class="row"> | |||
<div class="ui {{if $.PageIsUserCloudBrain}}sixteen{{else}}six{{end}} wide column" style="margin: 1rem 0;" id="userCloud"> | |||
@@ -20,7 +20,7 @@ | |||
data-all-compute="{{.i18n.Tr "admin.cloudbrain.all_computing_resources"}}" | |||
data-all-status="{{.i18n.Tr "admin.cloudbrain.all_status"}}"></div> | |||
{{template "admin/cloudbrain/search_dashboard" .}} | |||
<div class="ui container" style="width: 80%;"> | |||
<div class="ui container" style="width: 90%;"> | |||
{{template "base/alert" .}} | |||
<div class="ui grid"> | |||
<div class="row"> | |||
@@ -30,30 +30,42 @@ | |||
<!-- 表头 --> | |||
<div class="ui grid stackable" style="background: #f0f0f0;;"> | |||
<div class="row"> | |||
<div class="three wide column nowrap" style="width:15%"> | |||
<span style="margin:0 6px">{{$.i18n.Tr "repo.cloudbrain_task"}}</span> | |||
<div class="three wide column nowrap" style="width:12%!important"> | |||
<span>{{$.i18n.Tr "repo.cloudbrain_task"}}</span> | |||
</div> | |||
<div class="two wide column text center nowrap" style="width: 11% !important;"> | |||
<!-- 集群 --> | |||
<div class="one wide column text center nowrap" style="width:8% !important;"> | |||
<span>{{$.i18n.Tr "repo.modelarts.cluster"}}</span> | |||
</div> | |||
<div class="two wide column text center nowrap" style="width: 8% !important;"> | |||
<span>{{$.i18n.Tr "repo.modelarts.status"}}</span> | |||
</div> | |||
<div class="one wide column text center nowrap" style="width:10%"> | |||
<span style="margin:0 6px">{{$.i18n.Tr "repo.cloudbrain_task_type"}}</span> | |||
<div class="one wide column text center nowrap" style="width:8% !important"> | |||
<span>{{$.i18n.Tr "repo.cloudbrain_task_type"}}</span> | |||
</div> | |||
<div class="two wide column text center nowrap" style="width: 11% !important;"> | |||
<div class="two wide column text center nowrap" style="width: 8% !important;"> | |||
<span>{{$.i18n.Tr "repo.modelarts.createtime"}}</span> | |||
</div> | |||
<div class="one wide column text center nowrap" style="width:8.5% !important;"> | |||
<div class="one wide column text center nowrap" style="width:6% !important;"> | |||
<span>{{$.i18n.Tr "repo.cloudbrain_status_runtime"}}</span> | |||
</div> | |||
<div class="one wide column text center nowrap" style="width:8.5% !important;"> | |||
<div class="one wide column text center nowrap" style="width:6% !important;"> | |||
<span>{{$.i18n.Tr "repo.modelarts.computing_resources"}}</span> | |||
</div> | |||
<div class="two wide column text center nowrap" style="width: 14.5%!important;"> | |||
<!-- 智算中心 --> | |||
<div class="one wide column text center nowrap" style="width:8% !important;"> | |||
<span>{{$.i18n.Tr "repo.modelarts.ai_center"}}</span> | |||
</div> | |||
<!-- XPU类型 --> | |||
<div class="one wide column text center nowrap" style="width:10% !important;"> | |||
<span>{{$.i18n.Tr "repo.modelarts.card_type"}}</span> | |||
</div> | |||
<div class="two wide column text center nowrap" style="width: 11%!important;"> | |||
<span>{{$.i18n.Tr "repository"}}</span> | |||
</div> | |||
<div class="three wide column text center nowrap" style="width: 21.5%!important;"> | |||
<div class="three wide column text center nowrap" style="width: 15%!important;"> | |||
<span>{{$.i18n.Tr "repo.cloudbrain_operate"}}</span> | |||
</div> | |||
</div> | |||
@@ -70,48 +82,52 @@ | |||
{{$JobID = .JobID}} | |||
{{end}} | |||
<!-- {{$JobID}} --> | |||
<div class="three wide column nowrap" style="width:15%"> | |||
<div class="three wide column nowrap" style="width:12% !important"> | |||
{{if eq .JobType "DEBUG"}} | |||
<a class="title" | |||
href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain/{{$JobID}}{{else}}/modelarts/notebook/{{$JobID}}{{end}}" | |||
title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||
<span class="fitted" | |||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
</a> | |||
{{else if or (eq .JobType "SNN4IMAGENET") (eq .JobType "BRAINSCORE")}} | |||
<a class="title" | |||
href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/cloudbrain/benchmark/{{$JobID}}" | |||
title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||
<span class="fitted" | |||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
</a> | |||
{{else if eq .JobType "INFERENCE"}} | |||
<a class="title" | |||
href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/{{if eq .Cloudbrain.Type 1}}modelarts{{else if eq .Cloudbrain.Type 0}}cloudbrain{{end}}/inference-job/{{$JobID}}" | |||
title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||
<span class="fitted" | |||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
</a> | |||
{{else if eq .JobType "TRAIN"}} | |||
<a class="title" | |||
href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/{{if eq .Cloudbrain.Type 1}}modelarts{{else if eq .Cloudbrain.Type 0}}cloudbrain{{else if eq .Cloudbrain.Type 2}}grampus{{end}}/train-job/{{$JobID}}" | |||
title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||
<span class="fitted" | |||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
</a> | |||
{{else if eq .JobType "BENCHMARK"}} | |||
<a class="title" | |||
href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/cloudbrain/benchmark/{{$JobID}}" | |||
title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||
<span class="fitted" | |||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
</a> | |||
{{end}} | |||
</div> | |||
<!-- 集群 --> | |||
<div class="one wide column text center nowrap" style="width:8% !important;"> | |||
<span | |||
style="font-size: 12px;">{{if .Cluster}}{{.Cluster}}{{else}}--{{end}}</span> | |||
</div> | |||
<!-- 任务状态 --> | |||
<div class="two wide column text center nowrap" | |||
style="padding-left: 2.2rem !important; width: 11% !important;"> | |||
style="width: 8% !important;"> | |||
<span class="job-status" id="{{$JobID}}" | |||
data-repopath='{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .JobType "DEBUG"}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}{{else if eq .JobType "INFERENCE"}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts{{end}}/inference-job{{else if eq .JobType "TRAIN"}}{{if eq .ComputeResource "NPU"}}/modelarts/train-job{{else}}/cloudbrain/train-job{{end}}{{else if eq .JobType "BENCHMARK"}}/cloudbrain{{end}}' | |||
data-jobid="{{$JobID}}" data-version="{{.VersionName}}"> | |||
@@ -123,32 +139,44 @@ | |||
<!-- 任务类型 --> | |||
{{$JobType := $.i18n.Tr (printf "cloudbrain.%s" .JobType)}} | |||
<div class="one wide column text center nowrap" style="width:10%"> | |||
<div class="one wide column text center nowrap" style="width:8% !important"> | |||
<span style="font-size: 12px;" title="{{.JobType}}">{{$JobType}}</span> | |||
</div> | |||
<!-- 任务创建时间 --> | |||
<div class="two wide column text center nowrap" style="width: 11% !important;"> | |||
<div class="two wide column text center nowrap" style="width: 8% !important;"> | |||
<span style="font-size: 12px;" | |||
class="">{{TimeSinceUnix1 .Cloudbrain.CreatedUnix}}</span> | |||
</div> | |||
<!-- 任务运行时间 --> | |||
<div class="one wide column text center nowrap" style="width:8.5% !important;"> | |||
<div class="one wide column text center nowrap" style="width:6% !important;"> | |||
<span style="font-size: 12px;" | |||
id="duration-{{$JobID}}">{{if .TrainJobDuration}}{{.TrainJobDuration}}{{else}}--{{end}}</span> | |||
</div> | |||
<!-- 计算资源 --> | |||
<div class="one wide column text center nowrap" style="width:8.5% !important;"> | |||
<div class="one wide column text center nowrap" style="width:6% !important;"> | |||
<span | |||
style="font-size: 12px;">{{if .ComputeResource}}{{.ComputeResource}}{{else}}--{{end}}</span> | |||
</div> | |||
<!-- 智算中心 --> | |||
<div class="one wide column text center nowrap" style="width:8% !important;"> | |||
<span | |||
style="font-size: 12px;">{{if .AiCenter}}{{.AiCenter}}{{else}}--{{end}}</span> | |||
</div> | |||
<!-- XPU类型 --> | |||
<div class="one wide column text center nowrap" style="width:10% !important;"> | |||
<span style="font-size: 12px;" title="{{.CardType}}"> | |||
{{if .CardType}}{{.CardType}}{{else}}--{{end}} | |||
</span> | |||
</div> | |||
<!-- 项目 --> | |||
<div class="two wide column text center nowrap" style="width: 14.5%!important;"> | |||
<div class="two wide column text center nowrap" style="width: 11%!important;"> | |||
<a href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}" | |||
title="{{.Repo.OwnerName}}/{{.Repo.Alias}}">{{.Repo.OwnerName}}/{{.Repo.Alias}}</a> | |||
</div> | |||
<div class="three wide column text center nowrap" style="width: 21.5%!important;"> | |||
<div class="three wide column text center nowrap" style="width: 15%!important;"> | |||
{{if eq .JobType "DEBUG"}} | |||
<div class="ui compact buttons"> | |||
<form id="debugAgainForm-{{$JobID}}"> | |||
@@ -226,33 +254,37 @@ | |||
<div class="ui grid stackable item"> | |||
<div class="row"> | |||
<!-- 任务名 --> | |||
<div class="three wide column nowrap" style="width:15%"> | |||
<div class="three wide column nowrap" style="width:12% !important"> | |||
{{if eq .JobType "DEBUG"}} | |||
<a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
<a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||
<span class="fitted" | |||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
</a> | |||
{{else if eq .JobType "INFERENCE"}} | |||
<a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
<a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||
<span class="fitted" | |||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
</a> | |||
{{else if eq .JobType "TRAIN"}} | |||
<a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
<a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||
<span class="fitted" | |||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
</a> | |||
{{else if eq .JobType "BENCHMARK"}} | |||
<a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
<a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||
<span class="fitted" | |||
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
</a> | |||
{{end}} | |||
</div> | |||
<!-- 集群 --> | |||
<div class="one wide column text center nowrap" style="width:8% !important;"> | |||
<span | |||
style="font-size: 12px;">{{if .Cluster}}{{.Cluster}}{{else}}--{{end}}</span> | |||
</div> | |||
<!-- 任务状态 --> | |||
<div class="two wide column text center nowrap" | |||
style="padding-left: 2.2rem !important; width: 11% !important;"> | |||
style="padding-left: 2.2rem !important; width: 8% !important;"> | |||
<span class="job-status" id="{{$JobID}}" data-jobid="{{$JobID}}" | |||
data-version="{{.VersionName}}"> | |||
<span><i id="{{$JobID}}-icon" style="vertical-align: middle;" | |||
@@ -262,31 +294,42 @@ | |||
</div> | |||
<!-- 任务类型 --> | |||
{{$JobType := $.i18n.Tr (printf "cloudbrain.%s" .JobType)}} | |||
<div class="one wide column text center nowrap" style="width:10%"> | |||
<div class="one wide column text center nowrap" style="width:8%"> | |||
<span style="font-size: 12px;" title="{{.JobType}}">{{$JobType}}</span> | |||
</div> | |||
<!-- 任务创建时间 --> | |||
<div class="two wide column text center nowrap" style="width: 11% !important;"> | |||
<div class="two wide column text center nowrap" style="width: 8% !important;"> | |||
<span style="font-size: 12px;" | |||
class="">{{TimeSinceUnix1 .Cloudbrain.CreatedUnix}}</span> | |||
</div> | |||
<!-- 任务运行时间 --> | |||
<div class="one wide column text center nowrap" style="width:8.5% !important;"> | |||
<div class="one wide column text center nowrap" style="width:6% !important;"> | |||
<span style="font-size: 12px;" | |||
id="duration-{{$JobID}}">{{if .TrainJobDuration}}{{.TrainJobDuration}}{{else}}--{{end}}</span> | |||
</div> | |||
<!-- 计算资源 --> | |||
<div class="one wide column text center nowrap" style="width:8.5% !important;"> | |||
<div class="one wide column text center nowrap" style="width:6% !important;"> | |||
<span | |||
style="font-size: 12px;">{{if .ComputeResource}}{{.ComputeResource}}{{else}}--{{end}}</span> | |||
</div> | |||
<!-- 创建者 --> | |||
<!-- 智算中心 --> | |||
<div class="one wide column text center nowrap" style="width:8% !important;"> | |||
<span | |||
style="font-size: 12px;">{{if .AiCenter}}{{.AiCenter}}{{else}}--{{end}}</span> | |||
</div> | |||
<!-- XPU类型 --> | |||
<div class="one wide column text center nowrap" style="width:10% !important;"> | |||
<span style="font-size: 12px;" title="{{.CardType}}"> | |||
{{if .CardType}}{{.CardType}}{{else}}--{{end}} | |||
</span> | |||
</div> | |||
<!-- 项目 --> | |||
<div class="two wide column text center nowrap" style="width: 14.5%!important;"> | |||
<div class="two wide column text center nowrap" style="width: 11%!important;"> | |||
<a href="" title="">--</a> | |||
</div> | |||
<div class="three wide column text center nowrap" style="width: 21.5%!important;"> | |||
<div class="three wide column text center nowrap" style="width: 15%!important;"> | |||
{{if eq .JobType "DEBUG"}} | |||
<div class="ui compact buttons"> | |||
<form id="debugAgainForm-{{$JobID}}"> | |||