|
|
|
@@ -435,15 +435,29 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if cloudbrain.ResourceSpecs == nil { |
|
|
|
json.Unmarshal([]byte(setting.ResourceSpecs), &cloudbrain.ResourceSpecs) |
|
|
|
} |
|
|
|
for _, tmp := range cloudbrain.ResourceSpecs.ResourceSpec { |
|
|
|
if tmp.Id == task.ResourceSpecId { |
|
|
|
ctx.Data["GpuNum"] = tmp.GpuNum |
|
|
|
ctx.Data["CpuNum"] = tmp.CpuNum |
|
|
|
ctx.Data["MemMiB"] = tmp.MemMiB |
|
|
|
ctx.Data["ShareMemMiB"] = tmp.ShareMemMiB |
|
|
|
if task.JobType == string(models.JobTypeTrain) { |
|
|
|
if cloudbrain.TrainResourceSpecs == nil { |
|
|
|
json.Unmarshal([]byte(setting.TrainResourceSpecs), &cloudbrain.TrainResourceSpecs) |
|
|
|
} |
|
|
|
for _, tmp := range cloudbrain.TrainResourceSpecs.ResourceSpec { |
|
|
|
if tmp.Id == task.ResourceSpecId { |
|
|
|
ctx.Data["GpuNum"] = tmp.GpuNum |
|
|
|
ctx.Data["CpuNum"] = tmp.CpuNum |
|
|
|
ctx.Data["MemMiB"] = tmp.MemMiB |
|
|
|
ctx.Data["ShareMemMiB"] = tmp.ShareMemMiB |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
if cloudbrain.ResourceSpecs == nil { |
|
|
|
json.Unmarshal([]byte(setting.ResourceSpecs), &cloudbrain.ResourceSpecs) |
|
|
|
} |
|
|
|
for _, tmp := range cloudbrain.ResourceSpecs.ResourceSpec { |
|
|
|
if tmp.Id == task.ResourceSpecId { |
|
|
|
ctx.Data["GpuNum"] = tmp.GpuNum |
|
|
|
ctx.Data["CpuNum"] = tmp.CpuNum |
|
|
|
ctx.Data["MemMiB"] = tmp.MemMiB |
|
|
|
ctx.Data["ShareMemMiB"] = tmp.ShareMemMiB |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|