|
|
@@ -53,6 +53,8 @@ const ( |
|
|
//NPU |
|
|
//NPU |
|
|
tplGrampusNotebookNPUNew base.TplName = "repo/grampus/notebook/npu/new" |
|
|
tplGrampusNotebookNPUNew base.TplName = "repo/grampus/notebook/npu/new" |
|
|
tplGrampusTrainJobNPUNew base.TplName = "repo/grampus/trainjob/npu/new" |
|
|
tplGrampusTrainJobNPUNew base.TplName = "repo/grampus/trainjob/npu/new" |
|
|
|
|
|
//GCU |
|
|
|
|
|
tplGrampusNotebookGCUNew base.TplName = "repo/grampus/notebook/gcu/new" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
func GrampusNotebookNew(ctx *context.Context) { |
|
|
func GrampusNotebookNew(ctx *context.Context) { |
|
|
@@ -61,6 +63,8 @@ func GrampusNotebookNew(ctx *context.Context) { |
|
|
processType := grampus.ProcessorTypeGPU |
|
|
processType := grampus.ProcessorTypeGPU |
|
|
if notebookType == 1 { |
|
|
if notebookType == 1 { |
|
|
processType = grampus.ProcessorTypeNPU |
|
|
processType = grampus.ProcessorTypeNPU |
|
|
|
|
|
} else if notebookType == 2 { |
|
|
|
|
|
processType = grampus.ProcessorTypeGCU |
|
|
} |
|
|
} |
|
|
err := grampusNotebookNewDataPrepare(ctx, processType) |
|
|
err := grampusNotebookNewDataPrepare(ctx, processType) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
@@ -69,8 +73,10 @@ func GrampusNotebookNew(ctx *context.Context) { |
|
|
} |
|
|
} |
|
|
if processType == grampus.ProcessorTypeGPU { |
|
|
if processType == grampus.ProcessorTypeGPU { |
|
|
ctx.HTML(http.StatusOK, tplGrampusNotebookGPUNew) |
|
|
ctx.HTML(http.StatusOK, tplGrampusNotebookGPUNew) |
|
|
} else { |
|
|
|
|
|
|
|
|
} else if processType == grampus.ProcessorTypeNPU { |
|
|
ctx.HTML(http.StatusOK, tplGrampusNotebookNPUNew) |
|
|
ctx.HTML(http.StatusOK, tplGrampusNotebookNPUNew) |
|
|
|
|
|
} else if processType == grampus.ProcessorTypeGCU { |
|
|
|
|
|
ctx.HTML(http.StatusOK, tplGrampusNotebookGCUNew) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
@@ -118,6 +124,12 @@ func GrampusNotebookCreate(ctx *context.Context, form auth.CreateGrampusNotebook |
|
|
computeSource = models.NPUResource |
|
|
computeSource = models.NPUResource |
|
|
computeSourceSimple = models.NPU |
|
|
computeSourceSimple = models.NPU |
|
|
codeStoragePath = grampus.JobPath + jobName + modelarts.CodePath |
|
|
codeStoragePath = grampus.JobPath + jobName + modelarts.CodePath |
|
|
|
|
|
} else if form.Type == 2 { |
|
|
|
|
|
tpl = tplGrampusNotebookGCUNew |
|
|
|
|
|
processType = grampus.ProcessorTypeGCU |
|
|
|
|
|
computeSource = models.GCUResource |
|
|
|
|
|
computeSourceSimple = models.GCU |
|
|
|
|
|
codeStoragePath = grampus.JobPath + jobName + modelarts.CodePath |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
lock := redis_lock.NewDistributeLock(redis_key.CloudbrainBindingJobNameKey(fmt.Sprint(repo.ID), string(models.JobTypeDebug), displayJobName)) |
|
|
lock := redis_lock.NewDistributeLock(redis_key.CloudbrainBindingJobNameKey(fmt.Sprint(repo.ID), string(models.JobTypeDebug), displayJobName)) |
|
|
@@ -295,7 +307,7 @@ func grampusNotebookNewDataPrepare(ctx *context.Context, processType string) err |
|
|
ctx.Data["display_job_name"] = displayJobName |
|
|
ctx.Data["display_job_name"] = displayJobName |
|
|
|
|
|
|
|
|
//get valid images |
|
|
//get valid images |
|
|
if processType == grampus.ProcessorTypeNPU { |
|
|
|
|
|
|
|
|
if processType == grampus.ProcessorTypeNPU || processType == grampus.ProcessorTypeGCU { |
|
|
images, err := grampus.GetImages(processType, string(models.JobTypeDebug)) |
|
|
images, err := grampus.GetImages(processType, string(models.JobTypeDebug)) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
log.Error("GetImages failed:", err.Error()) |
|
|
log.Error("GetImages failed:", err.Error()) |
|
|
@@ -311,6 +323,10 @@ func grampusNotebookNewDataPrepare(ctx *context.Context, processType string) err |
|
|
computeResourceSimple = models.NPU |
|
|
computeResourceSimple = models.NPU |
|
|
datasetType = models.TypeCloudBrainTwo |
|
|
datasetType = models.TypeCloudBrainTwo |
|
|
computeResource = models.NPUResource |
|
|
computeResource = models.NPUResource |
|
|
|
|
|
} else if processType == grampus.ProcessorTypeGCU { |
|
|
|
|
|
computeResourceSimple = models.GCU |
|
|
|
|
|
datasetType = models.TypeCloudBrainAll |
|
|
|
|
|
computeResource = models.GCUResource |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
prepareGrampusSpecs(ctx, computeResourceSimple, models.JobTypeDebug) |
|
|
prepareGrampusSpecs(ctx, computeResourceSimple, models.JobTypeDebug) |
|
|
|