|
|
|
@@ -573,13 +573,10 @@ func deleteCloudBrainTask(task *models.AiModelConvert) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func StopModelConvert(ctx *context.Context) { |
|
|
|
id := ctx.Params(":id") |
|
|
|
log.Info("stop model convert start.id=" + id) |
|
|
|
func stopModelConvert(id string) error { |
|
|
|
job, err := models.QueryModelConvertById(id) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("Not found task.", err) |
|
|
|
return |
|
|
|
return err |
|
|
|
} |
|
|
|
if job.IsGpuTrainTask() { |
|
|
|
err = cloudbrain.StopJob(job.CloudBrainTaskId) |
|
|
|
@@ -600,6 +597,35 @@ func StopModelConvert(ctx *context.Context) { |
|
|
|
err = models.UpdateModelConvert(job) |
|
|
|
if err != nil { |
|
|
|
log.Error("UpdateModelConvert failed:", err) |
|
|
|
return err |
|
|
|
} |
|
|
|
return nil |
|
|
|
} |
|
|
|
|
|
|
|
func StopModelConvertApi(ctx *context.Context) { |
|
|
|
id := ctx.Params(":id") |
|
|
|
log.Info("stop model convert start.id=" + id) |
|
|
|
err := stopModelConvert(id) |
|
|
|
if err == nil { |
|
|
|
ctx.JSON(200, map[string]string{ |
|
|
|
"code": "0", |
|
|
|
"msg": "succeed", |
|
|
|
}) |
|
|
|
} else { |
|
|
|
ctx.JSON(200, map[string]string{ |
|
|
|
"code": "1", |
|
|
|
"msg": err.Error(), |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func StopModelConvert(ctx *context.Context) { |
|
|
|
id := ctx.Params(":id") |
|
|
|
log.Info("stop model convert start.id=" + id) |
|
|
|
err := stopModelConvert(id) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("Not found task.", err) |
|
|
|
return |
|
|
|
} |
|
|
|
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelmanage/convert_model") |
|
|
|
} |
|
|
|
|