|
|
@@ -238,19 +238,20 @@ func NotebookManage(ctx *context.Context) { |
|
|
|
|
|
|
|
|
task, err := models.GetCloudbrainByJobID(jobID) |
|
|
task, err := models.GetCloudbrainByJobID(jobID) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
ctx.ServerError("GetCloudbrainByJobID failed", err) |
|
|
|
|
|
|
|
|
log.Error("GetCloudbrainByJobID failed:%v", err, ctx.Data["MsgID"]) |
|
|
|
|
|
ctx.RenderWithErr("system error", tplDebugJobIndex, nil) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if action == models.ActionStop { |
|
|
if action == models.ActionStop { |
|
|
if task.Status != string(models.ModelArtsRunning) { |
|
|
if task.Status != string(models.ModelArtsRunning) { |
|
|
log.Error("the job(%s) is not running", task.JobName) |
|
|
|
|
|
|
|
|
log.Error("the job(%s) is not running", task.JobName, ctx.Data["MsgID"]) |
|
|
ctx.RenderWithErr("the job is not running", tplDebugJobIndex, nil) |
|
|
ctx.RenderWithErr("the job is not running", tplDebugJobIndex, nil) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
} else if action == models.ActionRestart { |
|
|
} else if action == models.ActionRestart { |
|
|
if task.Status != string(models.ModelArtsStopped) && task.Status != string(models.ModelArtsStartFailed) && task.Status != string(models.ModelArtsCreateFailed) { |
|
|
if task.Status != string(models.ModelArtsStopped) && task.Status != string(models.ModelArtsStartFailed) && task.Status != string(models.ModelArtsCreateFailed) { |
|
|
log.Error("the job(%s) is not stopped", task.JobName) |
|
|
|
|
|
|
|
|
log.Error("the job(%s) is not stopped", task.JobName, ctx.Data["MsgID"]) |
|
|
ctx.RenderWithErr("the job is not stopped", tplDebugJobIndex, nil) |
|
|
ctx.RenderWithErr("the job is not stopped", tplDebugJobIndex, nil) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
@@ -267,8 +268,10 @@ func NotebookManage(ctx *context.Context) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
action = models.ActionStart |
|
|
} else { |
|
|
} else { |
|
|
log.Error("the action(%s) is illegal", action) |
|
|
|
|
|
|
|
|
log.Error("the action(%s) is illegal", action, ctx.Data["MsgID"]) |
|
|
ctx.RenderWithErr("非法操作", tplDebugJobIndex, nil) |
|
|
ctx.RenderWithErr("非法操作", tplDebugJobIndex, nil) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
@@ -278,7 +281,7 @@ func NotebookManage(ctx *context.Context) { |
|
|
} |
|
|
} |
|
|
res, err := modelarts.ManageNotebook(jobID, param) |
|
|
res, err := modelarts.ManageNotebook(jobID, param) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
log.Error("ManageNotebook(%s) failed:%v", task.JobName, err.Error()) |
|
|
|
|
|
|
|
|
log.Error("ManageNotebook(%s) failed:%v", task.JobName, err.Error(), ctx.Data["MsgID"]) |
|
|
ctx.RenderWithErr("启动失败", tplDebugJobIndex, nil) |
|
|
ctx.RenderWithErr("启动失败", tplDebugJobIndex, nil) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
@@ -286,11 +289,11 @@ func NotebookManage(ctx *context.Context) { |
|
|
task.Status = res.CurrentStatus |
|
|
task.Status = res.CurrentStatus |
|
|
err = models.UpdateJob(task) |
|
|
err = models.UpdateJob(task) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
log.Error("UpdateJob(%s) failed:%v", task.JobName, err.Error()) |
|
|
|
|
|
|
|
|
log.Error("UpdateJob(%s) failed:%v", task.JobName, err.Error(), ctx.Data["MsgID"]) |
|
|
ctx.RenderWithErr("system error", tplDebugJobIndex, nil) |
|
|
ctx.RenderWithErr("system error", tplDebugJobIndex, nil) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob") |
|
|
|
|
|
|
|
|
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=all") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func NotebookDel(ctx *context.Context) { |
|
|
func NotebookDel(ctx *context.Context) { |
|
|
|