Browse Source

提交代码

tags/v1.22.11.3^2
ychao_1983 3 years ago
parent
commit
77ac02cfe9
1 changed files with 4 additions and 6 deletions
  1. +4
    -6
      modules/modelarts/modelarts.go

+ 4
- 6
modules/modelarts/modelarts.go View File

@@ -11,8 +11,6 @@ import (
"strconv"
"strings"

"github.com/go-resty/resty/v2"

"code.gitea.io/gitea/modules/cloudbrain"

"code.gitea.io/gitea/modules/modelarts_cd"
@@ -932,8 +930,8 @@ func HandleNotebookInfo(task *models.Cloudbrain) error {

func uploadNoteBookFile(task *models.Cloudbrain, result *models.GetNotebook2Result) {
jupyterUrl := result.Url + "?token=" + result.Token
client := getRestyClient()
cookies, xsrf := getCookiesAndCsrf(client, jupyterUrl)
cookies, xsrf := getCookiesAndCsrf(jupyterUrl)
if xsrf == "" {
log.Error("browser jupyterUrl failed:%v", task.DisplayJobName)
} else {
@@ -945,7 +943,7 @@ func uploadNoteBookFile(task *models.Cloudbrain, result *models.GetNotebook2Resu
}

base64Content := base64.StdEncoding.EncodeToString(fileContents)
client := getRestyClient()
uploadUrl := getJupyterBaseUrl(result.Url) + "api/contents/" + path.Base(task.BootFile)
res, err := client.R().
SetCookies(cookies).
@@ -973,7 +971,7 @@ func getJupyterBaseUrl(url string) string {
return baseUrl
}

func getCookiesAndCsrf(client *resty.Client, jupyterUrl string) ([]*http.Cookie, string) {
func getCookiesAndCsrf(jupyterUrl string) ([]*http.Cookie, string) {
log.Info("jupyter url:"+jupyterUrl)
var cookies []*http.Cookie
for i := 0; i < 10; i++ {


Loading…
Cancel
Save