Reviewed-on: https://openi.pcl.ac.cn/OpenI/aiforge/pulls/3463 Reviewed-by: zouap <zouap@pcl.ac.cn>pull/3473/head
@@ -1566,7 +1566,8 @@ type CreateGrampusJobResponse struct { | |||||
type GetGrampusJobResponse struct { | type GetGrampusJobResponse struct { | ||||
GrampusResult | GrampusResult | ||||
JobInfo GrampusJobInfo `json:"otJob"` | |||||
JobInfo GrampusJobInfo `json:"otJob"` | |||||
ExitDiagnostics string `json:"exitDiagnostics"` | |||||
} | } | ||||
type GrampusNotebookResponse struct { | type GrampusNotebookResponse struct { | ||||
@@ -198,7 +198,6 @@ sendjob: | |||||
SetAuthToken(TOKEN). | SetAuthToken(TOKEN). | ||||
SetResult(&result). | SetResult(&result). | ||||
Get(HOST + urlTrainJob + "/" + jobID) | Get(HOST + urlTrainJob + "/" + jobID) | ||||
if err != nil { | if err != nil { | ||||
return nil, fmt.Errorf("resty GetJob: %v", err) | return nil, fmt.Errorf("resty GetJob: %v", err) | ||||
} | } | ||||
@@ -22,9 +22,9 @@ import ( | |||||
const ( | const ( | ||||
//notebook | //notebook | ||||
storageTypeOBS = "obs" | |||||
autoStopDuration = 4 * 60 * 60 | |||||
AutoStopDurationMs = 4 * 60 * 60 * 1000 | |||||
storageTypeOBS = "obs" | |||||
autoStopDuration = 4 * 60 * 60 | |||||
AutoStopDurationMs = 4 * 60 * 60 * 1000 | |||||
CodePath = "/code/" | CodePath = "/code/" | ||||
OutputPath = "/output/" | OutputPath = "/output/" | ||||
@@ -168,7 +168,6 @@ type OrgMultiNode struct { | |||||
Node []int `json:"node"` | Node []int `json:"node"` | ||||
} | } | ||||
type Parameters struct { | type Parameters struct { | ||||
Parameter []struct { | Parameter []struct { | ||||
Label string `json:"label"` | Label string `json:"label"` | ||||
@@ -1359,6 +1359,23 @@ func GrampusGetLog(ctx *context.Context) { | |||||
}) | }) | ||||
return | return | ||||
} | } | ||||
result, err := grampus.GetJob(jobID) | |||||
if err != nil { | |||||
log.Error("GetJob(%s) failed:%v", job.JobName, err) | |||||
ctx.JSON(http.StatusOK, map[string]interface{}{ | |||||
"JobName": job.JobName, | |||||
"Content": content, | |||||
"CanLogDownload": false, | |||||
}) | |||||
return | |||||
} | |||||
if result != nil { | |||||
job.Status = grampus.TransTrainJobStatus(result.JobInfo.Status) | |||||
if job.Status == models.GrampusStatusFailed { | |||||
content = content + "\n" + result.ExitDiagnostics | |||||
} | |||||
} | |||||
canLogDownload := err == nil && job.IsUserHasRight(ctx.User) | canLogDownload := err == nil && job.IsUserHasRight(ctx.User) | ||||
ctx.JSON(http.StatusOK, map[string]interface{}{ | ctx.JSON(http.StatusOK, map[string]interface{}{ | ||||
"JobName": job.JobName, | "JobName": job.JobName, | ||||