From e69ac40f14064c2e791a3c8baa4b8069a59a25f1 Mon Sep 17 00:00:00 2001 From: liuzx Date: Thu, 10 Nov 2022 16:08:34 +0800 Subject: [PATCH 01/10] fix-3108 --- routers/api/v1/repo/cloudbrain.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/routers/api/v1/repo/cloudbrain.go b/routers/api/v1/repo/cloudbrain.go index 2e25fdefe..5e533762a 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) { + 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") @@ -634,7 +646,7 @@ func CloudbrainGetLog(ctx *context.APIContext) { endLine += 1 } } - + result = getLogFromModelDir(job.JobName, startLine, endLine, resultPath) if result == nil { log.Error("GetJobLog failed: %v", err, ctx.Data["MsgID"]) From 97a5cfd3c239ff6436351feb8926673a283b7ec6 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Fri, 11 Nov 2022 17:43:17 +0800 Subject: [PATCH 02/10] fix issue --- templates/repo/cloudbrain/trainjob/show.tmpl | 84 +--------------------------- 1 file changed, 1 insertion(+), 83 deletions(-) diff --git a/templates/repo/cloudbrain/trainjob/show.tmpl b/templates/repo/cloudbrain/trainjob/show.tmpl index 7bc3f2c82..f2cf2fabd 100644 --- a/templates/repo/cloudbrain/trainjob/show.tmpl +++ b/templates/repo/cloudbrain/trainjob/show.tmpl @@ -285,14 +285,8 @@
@@ -430,9 +424,6 @@
- - - {{$.i18n.Tr "repo.modelarts.train_job.run_parameter"}} @@ -504,25 +495,6 @@ - -
-
- -
- - - - - -
- -
- -
- - - -
-
{{$.i18n.Tr "repo.file_limit_100"}}
- @@ -700,11 +665,8 @@ - - - {{template "base/footer" .}} @@ -982,50 +944,6 @@ }); stopBubbling(arguments.callee.caller.arguments[0]) } - - function parseInfo() { - let jsonValue = document.getElementById("json_value").value; - let jsonObj = JSON.parse(jsonValue); - let podRoleName = jsonObj["podRoleName"]; - let html = ""; - if (podRoleName != null) { - let task0 = podRoleName["task1-0"]; - let podEvents = jsonObj["podEvents"]; - let podEventArray = podEvents[task0]; - if (podEventArray != null) { - for (var i = 0; i < podEventArray.length; i++) { - if (podEventArray[i]["reason"] != "") { - html += "

[" + 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, "
") - string = string.replace(/\n/g, "
"); - string = string.replace(/(\r\n)|(\n)/g, '
'); - - if (string != "") { - html += "

[ExitDiagnostics]

"; - html += "

" + string + "

"; - } - - document.getElementById("info_display").innerHTML = html; - } - ;(function() { var SPEC = {{ .Spec }}; var showPoint = false; From 082ba2af303b24d2584b906f0c455b8a03175ace Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Wed, 16 Nov 2022 09:50:52 +0800 Subject: [PATCH 03/10] fix issue --- templates/repo/cloudbrain/inference/show.tmpl | 52 --------------------------- 1 file changed, 52 deletions(-) diff --git a/templates/repo/cloudbrain/inference/show.tmpl b/templates/repo/cloudbrain/inference/show.tmpl index 3154b8ac6..beeccebf4 100644 --- a/templates/repo/cloudbrain/inference/show.tmpl +++ b/templates/repo/cloudbrain/inference/show.tmpl @@ -262,8 +262,6 @@
- -
-
- -
- - - - - -
- -
- -
-
Date: Wed, 16 Nov 2022 16:17:37 +0800 Subject: [PATCH 06/10] fix-3108 --- routers/api/v1/repo/cloudbrain.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/routers/api/v1/repo/cloudbrain.go b/routers/api/v1/repo/cloudbrain.go index 45e9ca2cb..066453e72 100755 --- a/routers/api/v1/repo/cloudbrain.go +++ b/routers/api/v1/repo/cloudbrain.go @@ -658,9 +658,16 @@ 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) + if job.JobType == string(models.JobTypeModelSafety) { + if ctx.Data["existStr"] != nil && result["Lines"].(int) < 50 { + content = content + ctx.Data["existStr"].(string) + } + } else { + if ctx.Data["existStr"] != nil { + content = content + ctx.Data["existStr"].(string) + } } + logFileName := result["FileName"] //Logs can only be downloaded if the file exists From 951a785bcefd47f9160c65ac93e64b66930247a5 Mon Sep 17 00:00:00 2001 From: liuzx Date: Wed, 16 Nov 2022 17:20:17 +0800 Subject: [PATCH 07/10] fix-3108 --- routers/api/v1/repo/cloudbrain.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/routers/api/v1/repo/cloudbrain.go b/routers/api/v1/repo/cloudbrain.go index 066453e72..8d87954b3 100755 --- a/routers/api/v1/repo/cloudbrain.go +++ b/routers/api/v1/repo/cloudbrain.go @@ -662,7 +662,8 @@ func CloudbrainGetLog(ctx *context.APIContext) { if ctx.Data["existStr"] != nil && result["Lines"].(int) < 50 { content = content + ctx.Data["existStr"].(string) } - } else { + } + if job.JobType == string(models.JobTypeTrain) || job.JobType == string(models.JobTypeInference) { if ctx.Data["existStr"] != nil { content = content + ctx.Data["existStr"].(string) } From 1ed8e113ce84494ea0aec329915f28dbdc3799ff Mon Sep 17 00:00:00 2001 From: liuzx Date: Wed, 16 Nov 2022 18:01:46 +0800 Subject: [PATCH 08/10] fix-3108 --- templates/repo/cloudbrain/trainjob/show.tmpl | 61 +--------------------------- 1 file changed, 1 insertion(+), 60 deletions(-) diff --git a/templates/repo/cloudbrain/trainjob/show.tmpl b/templates/repo/cloudbrain/trainjob/show.tmpl index 3af318286..75cad03b4 100644 --- a/templates/repo/cloudbrain/trainjob/show.tmpl +++ b/templates/repo/cloudbrain/trainjob/show.tmpl @@ -893,66 +893,7 @@ $('.secondary.menu .item').tab(); }); - let userName - let repoPath - let jobID - let downlaodFlag = {{ $.canDownload }} - let taskID = {{ $.task.ID }} - let realJobName = {{ $.task.JobName }} - $(document).ready(function () { - let url = window.location.href; - let urlArr = url.split('/') - userName = urlArr.slice(-5)[0] - repoPath = urlArr.slice(-4)[0] - jobID = urlArr.slice(-1)[0] - }) - function stopBubbling(e) { - e = window.event || e; - if (e.stopPropagation) { - e.stopPropagation(); //阻止事件 冒泡传播 - } else { - e.cancelBubble = true; //ie兼容 - } - } - - function loadLog(version_name) { - document.getElementById("mask").style.display = "block" - let startLine = $('input[name=end_line]').val(); - if(startLine==""){ - startLine=0; - } - let endLine = $('input[name=end_line]').val(); - if(endLine==""){ - endLine = 50; - } - $.get(`/${userName}/${repoPath}/cloudbrain/train-job/${jobID}/get_log?endLine=${endLine}&startLine=${startLine}`, (data) => { - $('input[name=end_line]').val(data.EndLine) - $('input[name=start_line]').val(data.StartLine) - $(`#log_file${version_name}`).text(data.Content) - document.getElementById("mask").style.display = "none" - }).fail(function (err) { - console.log(err); - document.getElementById("mask").style.display = "none" - }); - } - - function refreshStatus(version_name) { - $.get(`/api/v1/repos/${userName}/${repoPath}/cloudbrain/${taskID}?version_name=${versionname}`, (data) => { - // header status and duration - //$(`#${version_name}-duration-span`).text(data.JobDuration) - $(`#${version_name}-status-span span`).text(data.JobStatus) - $(`#${version_name}-status-span i`).attr("class", data.JobStatus) - // detail status and duration - //$('#'+version_name+'-duration').text(data.JobDuration) - $('#' + version_name + '-status').text(data.JobStatus) - loadLog(version_name) - - - }).fail(function (err) { - console.log(err); - }); - stopBubbling(arguments.callee.caller.arguments[0]) - } + ;(function() { var SPEC = {{ .Spec }}; var showPoint = false; From eab954856da74928402dcbc7502bec7ff4c936a1 Mon Sep 17 00:00:00 2001 From: liuzx Date: Thu, 17 Nov 2022 09:39:30 +0800 Subject: [PATCH 09/10] fix-3108 --- routers/api/v1/repo/cloudbrain.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/routers/api/v1/repo/cloudbrain.go b/routers/api/v1/repo/cloudbrain.go index 8d87954b3..e57e59b5b 100755 --- a/routers/api/v1/repo/cloudbrain.go +++ b/routers/api/v1/repo/cloudbrain.go @@ -658,16 +658,16 @@ func CloudbrainGetLog(ctx *context.APIContext) { if result["Content"] != nil { content = result["Content"].(string) } - if job.JobType == string(models.JobTypeModelSafety) { - if ctx.Data["existStr"] != nil && result["Lines"].(int) < 50 { - content = content + ctx.Data["existStr"].(string) - } - } - if job.JobType == string(models.JobTypeTrain) || job.JobType == string(models.JobTypeInference) { - if ctx.Data["existStr"] != nil { - content = content + ctx.Data["existStr"].(string) - } - } + // if job.JobType == string(models.JobTypeModelSafety) { + if ctx.Data["existStr"] != nil && result["Lines"].(int) < 50 { + content = content + ctx.Data["existStr"].(string) + } + // } + // if job.JobType == string(models.JobTypeTrain) || job.JobType == string(models.JobTypeInference) { + // if ctx.Data["existStr"] != nil { + // content = content + ctx.Data["existStr"].(string) + // } + // } logFileName := result["FileName"] From c83dcaf5bb699e108a626e446fdd697ee6df5205 Mon Sep 17 00:00:00 2001 From: liuzx Date: Thu, 17 Nov 2022 10:02:42 +0800 Subject: [PATCH 10/10] fix-3108 --- routers/api/v1/repo/cloudbrain.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/routers/api/v1/repo/cloudbrain.go b/routers/api/v1/repo/cloudbrain.go index e57e59b5b..68baf3287 100755 --- a/routers/api/v1/repo/cloudbrain.go +++ b/routers/api/v1/repo/cloudbrain.go @@ -658,16 +658,10 @@ func CloudbrainGetLog(ctx *context.APIContext) { if result["Content"] != nil { content = result["Content"].(string) } - // if job.JobType == string(models.JobTypeModelSafety) { + if ctx.Data["existStr"] != nil && result["Lines"].(int) < 50 { content = content + ctx.Data["existStr"].(string) } - // } - // if job.JobType == string(models.JobTypeTrain) || job.JobType == string(models.JobTypeInference) { - // if ctx.Data["existStr"] != nil { - // content = content + ctx.Data["existStr"].(string) - // } - // } logFileName := result["FileName"]