From a6161bfddbc7e95db6860b0db96b61165610101c Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 1 Sep 2022 10:35:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A5=E5=BF=97=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/api/v1/repo/cloudbrain.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/routers/api/v1/repo/cloudbrain.go b/routers/api/v1/repo/cloudbrain.go index d127f27ed..33d8d89c0 100755 --- a/routers/api/v1/repo/cloudbrain.go +++ b/routers/api/v1/repo/cloudbrain.go @@ -492,17 +492,17 @@ func getLastLogFromModelDir(jobName string, lines int) map[string]interface{} { fileName = file.FileName path := storage.GetMinioPath(jobName+"/model/", file.FileName) allLines = getAllLineFromFile(path) - start := allLines - 50 - if start < 0 { - start = 0 + startLine := allLines - 50 + if startLine < 0 { + startLine = 0 } - count = allLines - start + count = allLines - startLine log.Info("path=" + path) reader, err := os.Open(path) defer reader.Close() if err == nil { r := bufio.NewReader(reader) - for i := start; i < allLines; i++ { + for i := 0; i < allLines; i++ { line, error := r.ReadString('\n') log.Info("line=" + line) if error == io.EOF { @@ -514,7 +514,9 @@ func getLastLogFromModelDir(jobName string, lines int) map[string]interface{} { break } if error == nil { - re = re + line + if i >= startLine { + re = re + line + } } } } else {