Browse Source

del&stop

tags/v1.22.3.2^2
lewis 3 years ago
parent
commit
01ba9c033c
3 changed files with 24 additions and 6 deletions
  1. +3
    -0
      modules/cloudbrain/cloudbrain.go
  2. +16
    -0
      routers/repo/cloudbrain.go
  3. +5
    -6
      routers/routes/routes.go

+ 3
- 0
modules/cloudbrain/cloudbrain.go View File

@@ -156,6 +156,7 @@ func GenerateTask(ctx *context.Context, displayJobName, jobName, image, command,
uuid

var resourceSpec *models.ResourceSpec
var versionCount int
if jobType == string(models.JobTypeDebug) {
if ResourceSpecs == nil {
json.Unmarshal([]byte(setting.ResourceSpecs), &ResourceSpecs)
@@ -166,6 +167,7 @@ func GenerateTask(ctx *context.Context, displayJobName, jobName, image, command,
}
}
} else if jobType == string(models.JobTypeTrain) {
versionCount = 1
if TrainResourceSpecs == nil {
json.Unmarshal([]byte(setting.TrainResourceSpecs), &TrainResourceSpecs)
}
@@ -276,6 +278,7 @@ func GenerateTask(ctx *context.Context, displayJobName, jobName, image, command,
BenchmarkChildTypeID: benchmarkChildTypeID,
Description: description,
IsLatestVersion: "1",
VersionCount: versionCount,
})

if err != nil {


+ 16
- 0
routers/repo/cloudbrain.go View File

@@ -1470,3 +1470,19 @@ func getTrainJobCommand(form auth.CreateCloudBrainForm) (string, error) {

return command, nil
}

func CloudBrainTrainJobDel(ctx *context.Context) {
var listType = ctx.Query("listType")
if err := deleteCloudbrainJob(ctx); err != nil {
log.Error("deleteCloudbrainJob failed: %v", err, ctx.Data["msgID"])
ctx.ServerError(err.Error(), err)
return
}

var isAdminPage = ctx.Query("isadminpage")
if ctx.IsUserSiteAdmin() && isAdminPage == "true" {
ctx.Redirect(setting.AppSubURL + "/admin" + "/cloudbrains")
} else {
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/train-job?debugListType=" + listType)
}
}

+ 5
- 6
routers/routes/routes.go View File

@@ -1018,18 +1018,17 @@ func RegisterRoutes(m *macaron.Macaron) {
})

m.Group("/train-job", func() {
m.Group("/:jobid", func() {
m.Group("/:id", func() {
m.Get("", reqRepoCloudBrainReader, repo.TrainJobShow)
m.Post("/stop", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.TrainJobStop)
m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.TrainJobDel)
m.Get("/model_download", cloudbrain.AdminOrJobCreaterRightForTrain, repo.ModelDownload)
m.Post("/stop", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.CloudBrainStop)
m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.CloudBrainTrainJobDel)
m.Get("/models", reqRepoCloudBrainReader, repo.CloudBrainShowModels)
m.Get("/download_model", cloudbrain.AdminOrJobCreaterRight, repo.CloudBrainDownloadModel)
//m.Get("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, repo.TrainJobNewVersion)
//m.Post("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, bindIgnErr(auth.CreateModelArtsTrainJobForm{}), repo.TrainJobCreateVersion)
})
m.Get("/create", reqWechatBind, reqRepoCloudBrainWriter, repo.CloudBrainTrainJobNew)
m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateCloudBrainForm{}), repo.CloudBrainCreate)

//m.Get("/para-config-list", reqRepoCloudBrainReader, repo.TrainJobGetConfigList)
})
}, context.RepoRef())
m.Group("/modelmanage", func() {


Loading…
Cancel
Save