diff --git a/routers/api/v1/repo/cloudbrain.go b/routers/api/v1/repo/cloudbrain.go index 7022dc011..68baf3287 100755 --- a/routers/api/v1/repo/cloudbrain.go +++ b/routers/api/v1/repo/cloudbrain.go @@ -596,12 +596,24 @@ func CloudbrainGetLog(ctx *context.APIContext) { existStr = taskRes.TaskStatuses[0].ExitDiagnostics } ctx.Data["existStr"] = existStr - log.Info("existStr=" + existStr) } else { ModelSafetyGetLog(ctx) return } + } + if job.JobType == string(models.JobTypeTrain) || job.JobType == string(models.JobTypeInference) { + if job.Type == models.TypeCloudBrainOne { + result, err := cloudbrain.GetJob(job.JobID) + existStr := "" + if err == nil && result != nil { + jobRes, _ := models.ConvertToJobResultPayload(result.Payload) + taskRoles := jobRes.TaskRoles + taskRes, _ := models.ConvertToTaskPod(taskRoles[cloudbrain.SubTaskName].(map[string]interface{})) + existStr = taskRes.TaskStatuses[0].ExitDiagnostics + } + ctx.Data["existStr"] = existStr + } } lines := ctx.QueryInt("lines") @@ -646,9 +658,11 @@ func CloudbrainGetLog(ctx *context.APIContext) { if result["Content"] != nil { content = result["Content"].(string) } + if ctx.Data["existStr"] != nil && result["Lines"].(int) < 50 { content = content + ctx.Data["existStr"].(string) } + logFileName := result["FileName"] //Logs can only be downloaded if the file exists diff --git a/templates/repo/cloudbrain/inference/show.tmpl b/templates/repo/cloudbrain/inference/show.tmpl index 3154b8ac6..aee08d659 100644 --- a/templates/repo/cloudbrain/inference/show.tmpl +++ b/templates/repo/cloudbrain/inference/show.tmpl @@ -262,8 +262,6 @@
- -" + podEventArray[i]["message"] + "
"; - html += "" + podEventArray[i]["action"] + "
"; - } - } - } - let extras = jsonObj["extras"]; - if (extras != null) { - for (var i = 0; i < extras.length; i++) { - if (extras[i]["reason"] != "") { - html += "[" + extras[i]["reason"] + "]
"; - html += "" + extras[i]["message"] + "
"; - html += "" + extras[i]["action"] + "
"; - } - } - } - } - - let string = document.getElementById("ExitDiagnostics").value; - string = string.replace(/\r\n/g, "[ExitDiagnostics]
"; - html += "" + string + "
"; - } - - document.getElementById("info_display").innerHTML = html; - } - ;(function() { var SPEC = {{ .Spec }}; var showPoint = false; diff --git a/templates/repo/cloudbrain/trainjob/show.tmpl b/templates/repo/cloudbrain/trainjob/show.tmpl index 8193e80fc..75cad03b4 100644 --- a/templates/repo/cloudbrain/trainjob/show.tmpl +++ b/templates/repo/cloudbrain/trainjob/show.tmpl @@ -287,9 +287,7 @@ data-tab="first{{$k}}">{{$.i18n.Tr "repo.modelarts.train_job.config"}} {{$.i18n.Tr "repo.modelarts.log"}} - - + data-version="{{.VersionName}}">{{$.i18n.Tr "repo.modelarts.log"}} {{$.i18n.Tr "repo.model_download"}}[" + podEventArray[i]["reason"] + "]
"; - html += "" + podEventArray[i]["message"] + "
"; - html += "" + podEventArray[i]["action"] + "
"; - } - } - } - let extras = jsonObj["extras"]; - if (extras != null) { - for (var i = 0; i < extras.length; i++) { - if (extras[i]["reason"] != "") { - html += "[" + extras[i]["reason"] + "]
"; - html += "" + extras[i]["message"] + "
"; - html += "" + extras[i]["action"] + "
"; - } - } - } - } - - let string = document.getElementById("ExitDiagnostics").value; - string = string.replace(/\r\n/g, "[ExitDiagnostics]
"; - html += "" + string + "
"; - } - - document.getElementById("info_display").innerHTML = html; - } - + ;(function() { var SPEC = {{ .Spec }}; var showPoint = false;