Browse Source

修复日志显示问题

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.9.1^2
zouap 3 years ago
parent
commit
a6161bfddb
1 changed files with 8 additions and 6 deletions
  1. +8
    -6
      routers/api/v1/repo/cloudbrain.go

+ 8
- 6
routers/api/v1/repo/cloudbrain.go View File

@@ -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 {


Loading…
Cancel
Save