|
|
|
@@ -949,7 +949,7 @@ func GrampusStopJob(ctx *context.Context) { |
|
|
|
break |
|
|
|
} |
|
|
|
oldStatus := task.Status |
|
|
|
task.Status = string(models.GrampusStatusStopped) |
|
|
|
task.Status = getStopJobResponseStatus(res) |
|
|
|
if task.EndTime == 0 { |
|
|
|
task.EndTime = timeutil.TimeStampNow() |
|
|
|
} |
|
|
|
@@ -978,6 +978,14 @@ func GrampusStopJob(ctx *context.Context) { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
func getStopJobResponseStatus(res *models.GrampusStopJobResponse) string { |
|
|
|
newStatus := models.GrampusStatusStopping |
|
|
|
if res.Status != "" { |
|
|
|
newStatus = grampus.TransTrainJobStatus(res.Status) |
|
|
|
} |
|
|
|
return newStatus |
|
|
|
} |
|
|
|
|
|
|
|
func GrampusNotebookDel(ctx *context.Context) { |
|
|
|
var listType = ctx.Query("listType") |
|
|
|
if err := deleteGrampusJob(ctx); err != nil { |
|
|
|
@@ -1039,19 +1047,23 @@ func deleteGrampusJob(ctx *context.Context) error { |
|
|
|
return nil |
|
|
|
} |
|
|
|
|
|
|
|
type NotebookDataset struct { |
|
|
|
DatasetUrl string `json:"dataset_url"` |
|
|
|
} |
|
|
|
|
|
|
|
func GrampusNotebookShow(ctx *context.Context) { |
|
|
|
ctx.Data["PageIsCloudBrain"] = true |
|
|
|
|
|
|
|
var task *models.Cloudbrain |
|
|
|
task, err := models.GetCloudbrainByJobIDWithDeleted(ctx.Params(":jobid")) |
|
|
|
task, err := models.GetCloudbrainByIDWithDeleted(ctx.Params(":id")) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetCloudbrainByJobID failed:" + err.Error()) |
|
|
|
log.Error("GetCloudbrainByID failed:" + err.Error()) |
|
|
|
ctx.NotFound(ctx.Req.URL.RequestURI(), nil) |
|
|
|
return |
|
|
|
} |
|
|
|
task.ContainerIp = "" |
|
|
|
|
|
|
|
if task.DeletedAt.IsZero() { //normal record |
|
|
|
if task.DeletedAt.IsZero() && cloudbrainTask.IsTaskNotStop(task) { //normal record |
|
|
|
result, err := grampus.GetNotebookJob(task.JobID) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetJob failed:" + err.Error()) |
|
|
|
@@ -1116,9 +1128,13 @@ func GrampusNotebookShow(ctx *context.Context) { |
|
|
|
} |
|
|
|
} |
|
|
|
prepareSpec4Show(ctx, task) |
|
|
|
ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false) |
|
|
|
datasetList := make([]NotebookDataset, 0) |
|
|
|
_ = json.Unmarshal([]byte(task.DataUrl), &datasetList) |
|
|
|
|
|
|
|
ctx.Data["datasetDownload"] = datasetList |
|
|
|
ctx.Data["canDownload"] = cloudbrain.CanModifyJob(ctx, task) |
|
|
|
ctx.Data["ai_center"] = cloudbrainService.GetAiCenterShow(task.AiCenter, ctx) |
|
|
|
ctx.Data[""] = cloudbrainService.GetAiCenterShow(task.AiCenter, ctx) |
|
|
|
ctx.HTML(http.StatusOK, tplGrampusNotebookShow) |
|
|
|
} |
|
|
|
|
|
|
|
|