Browse Source

整合页面

tags/v1.21.12.1^2
liuzx 4 years ago
parent
commit
5c2b997d02
2 changed files with 22 additions and 12 deletions
  1. +11
    -10
      routers/repo/cloudbrain.go
  2. +11
    -2
      routers/repo/modelarts.go

+ 11
- 10
routers/repo/cloudbrain.go View File

@@ -243,11 +243,11 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) {
} }
repo := ctx.Repo.Repository repo := ctx.Repo.Repository
downloadCode(repo, codePath) downloadCode(repo, codePath)
uploadCodeToMinio(codePath + "/", jobName, "/code/")
uploadCodeToMinio(codePath+"/", jobName, "/code/")


modelPath := setting.JobPath + jobName + cloudbrain.ModelMountPath + "/" modelPath := setting.JobPath + jobName + cloudbrain.ModelMountPath + "/"
mkModelPath(modelPath) mkModelPath(modelPath)
uploadCodeToMinio(modelPath, jobName, cloudbrain.ModelMountPath + "/")
uploadCodeToMinio(modelPath, jobName, cloudbrain.ModelMountPath+"/")


benchmarkPath := setting.JobPath + jobName + cloudbrain.BenchMarkMountPath benchmarkPath := setting.JobPath + jobName + cloudbrain.BenchMarkMountPath
if setting.IsBenchmarkEnabled && jobType == string(models.JobTypeBenchmark) { if setting.IsBenchmarkEnabled && jobType == string(models.JobTypeBenchmark) {
@@ -258,30 +258,31 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) {
} }
} }
downloadRateCode(repo, jobName, setting.BenchmarkOwner, setting.BrainScoreName, benchmarkPath, form.BenchmarkCategory, gpuType) downloadRateCode(repo, jobName, setting.BenchmarkOwner, setting.BrainScoreName, benchmarkPath, form.BenchmarkCategory, gpuType)
uploadCodeToMinio(benchmarkPath + "/", jobName, cloudbrain.BenchMarkMountPath + "/")
uploadCodeToMinio(benchmarkPath+"/", jobName, cloudbrain.BenchMarkMountPath+"/")
} }


snn4imagenetPath := setting.JobPath + jobName + cloudbrain.Snn4imagenetMountPath snn4imagenetPath := setting.JobPath + jobName + cloudbrain.Snn4imagenetMountPath
if setting.IsSnn4imagenetEnabled && jobType == string(models.JobTypeSnn4imagenet) { if setting.IsSnn4imagenetEnabled && jobType == string(models.JobTypeSnn4imagenet) {
downloadRateCode(repo, jobName, setting.Snn4imagenetOwner, setting.Snn4imagenetName, snn4imagenetPath, "", "") downloadRateCode(repo, jobName, setting.Snn4imagenetOwner, setting.Snn4imagenetName, snn4imagenetPath, "", "")
uploadCodeToMinio(snn4imagenetPath + "/", jobName, cloudbrain.Snn4imagenetMountPath + "/")
uploadCodeToMinio(snn4imagenetPath+"/", jobName, cloudbrain.Snn4imagenetMountPath+"/")
} }


brainScorePath := setting.JobPath + jobName + cloudbrain.BrainScoreMountPath brainScorePath := setting.JobPath + jobName + cloudbrain.BrainScoreMountPath
if setting.IsBrainScoreEnabled && jobType == string(models.JobTypeBrainScore) { if setting.IsBrainScoreEnabled && jobType == string(models.JobTypeBrainScore) {
downloadRateCode(repo, jobName, setting.BrainScoreOwner, setting.BrainScoreName, brainScorePath, "", "") downloadRateCode(repo, jobName, setting.BrainScoreOwner, setting.BrainScoreName, brainScorePath, "", "")
uploadCodeToMinio(brainScorePath + "/", jobName, cloudbrain.BrainScoreMountPath + "/")
uploadCodeToMinio(brainScorePath+"/", jobName, cloudbrain.BrainScoreMountPath+"/")
} }


err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, codePath, getMinioPath(jobName, cloudbrain.ModelMountPath + "/"),
getMinioPath(jobName, cloudbrain.BenchMarkMountPath + "/"), getMinioPath(jobName, cloudbrain.Snn4imagenetMountPath + "/"),
getMinioPath(jobName, cloudbrain.BrainScoreMountPath + "/"), jobType, gpuQueue, resourceSpecId)
err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, codePath, getMinioPath(jobName, cloudbrain.ModelMountPath+"/"),
getMinioPath(jobName, cloudbrain.BenchMarkMountPath+"/"), getMinioPath(jobName, cloudbrain.Snn4imagenetMountPath+"/"),
getMinioPath(jobName, cloudbrain.BrainScoreMountPath+"/"), jobType, gpuQueue, resourceSpecId)
if err != nil { if err != nil {
cloudBrainNewDataPrepare(ctx) cloudBrainNewDataPrepare(ctx)
ctx.RenderWithErr(err.Error(), tplCloudBrainNew, &form) ctx.RenderWithErr(err.Error(), tplCloudBrainNew, &form)
return return
} }
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain")
// ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain")
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob")
} }


func CloudBrainShow(ctx *context.Context) { func CloudBrainShow(ctx *context.Context) {
@@ -608,7 +609,7 @@ func getImages(ctx *context.Context, imageType string) {


func GetModelDirs(jobName string, parentDir string) (string, error) { func GetModelDirs(jobName string, parentDir string) (string, error) {
var req string var req string
modelActualPath := getMinioPath(jobName, cloudbrain.ModelMountPath + "/")
modelActualPath := getMinioPath(jobName, cloudbrain.ModelMountPath+"/")
if parentDir == "" { if parentDir == "" {
req = "baseDir=" + modelActualPath req = "baseDir=" + modelActualPath
} else { } else {


+ 11
- 2
routers/repo/modelarts.go View File

@@ -41,12 +41,20 @@ const (
) )


func DebugJobIndex(ctx *context.Context) { func DebugJobIndex(ctx *context.Context) {
debugListType := ctx.Query("debugListType")
MustEnableCloudbrain(ctx) MustEnableCloudbrain(ctx)
repo := ctx.Repo.Repository repo := ctx.Repo.Repository
page := ctx.QueryInt("page") page := ctx.QueryInt("page")
if page <= 0 { if page <= 0 {
page = 1 page = 1
} }
debugType := modelarts.DebugType
if debugListType == modelarts.GPUResource {
debugType = models.TypeCloudBrainOne
}
if debugListType == modelarts.NPUResource {
debugType = models.TypeCloudBrainTwo
}


ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{ ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{
ListOptions: models.ListOptions{ ListOptions: models.ListOptions{
@@ -54,7 +62,7 @@ func DebugJobIndex(ctx *context.Context) {
PageSize: setting.UI.IssuePagingNum, PageSize: setting.UI.IssuePagingNum,
}, },
RepoID: repo.ID, RepoID: repo.ID,
Type: modelarts.DebugType,
Type: debugType,
JobType: string(models.JobTypeDebug), JobType: string(models.JobTypeDebug),
}) })
if err != nil { if err != nil {
@@ -185,7 +193,8 @@ func NotebookCreate(ctx *context.Context, form auth.CreateModelArtsNotebookForm)
return return
} }


ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/notebook")
// ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/notebook")
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob")
} }


func NotebookShow(ctx *context.Context) { func NotebookShow(ctx *context.Context) {


Loading…
Cancel
Save