|
|
|
@@ -2,7 +2,10 @@ package cloudbrain |
|
|
|
|
|
|
|
import ( |
|
|
|
"encoding/json" |
|
|
|
"errors" |
|
|
|
"fmt" |
|
|
|
"net/http" |
|
|
|
"strconv" |
|
|
|
"strings" |
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
|
@@ -276,11 +279,11 @@ func GetJobLog(jobID string) (*models.GetJobLogResult, error) { |
|
|
|
client := getRestyClient() |
|
|
|
var result models.GetJobLogResult |
|
|
|
req := models.GetJobLogParams{ |
|
|
|
Size: "5000", |
|
|
|
Sort: "log.offset", |
|
|
|
QueryInfo: models.QueryInfo{ |
|
|
|
Size: "5000", |
|
|
|
Sort: "log.offset", |
|
|
|
MatchInfo: models.MatchInfo{ |
|
|
|
PodName: jobID + "task1-0", |
|
|
|
PodName: jobID + "-task1-0", |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
@@ -290,11 +293,17 @@ func GetJobLog(jobID string) (*models.GetJobLogResult, error) { |
|
|
|
SetAuthToken(TOKEN). |
|
|
|
SetBody(req). |
|
|
|
SetResult(&result). |
|
|
|
Post(HOST + "/es/_search?_source=message&scroll=5m") |
|
|
|
Post(HOST + "es/_search?_source=message&scroll=5m") |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
log.Info("GetJobLog failed: %v", err) |
|
|
|
return &result, fmt.Errorf("resty GetJobLog: %v, %s", err, res.String()) |
|
|
|
} |
|
|
|
|
|
|
|
if !strings.Contains(res.Status(), strconv.Itoa(http.StatusOK)) { |
|
|
|
log.Info("res.Status(): %s, response: %s", res.Status(), res.String()) |
|
|
|
return &result, errors.New(res.String()) |
|
|
|
} |
|
|
|
|
|
|
|
return &result, nil |
|
|
|
} |