Browse Source

Merge remote-tracking branch 'origin/V20220228' into fix-cloudbrain-jobid

tags/v1.22.2.2^2
liuzx 4 years ago
parent
commit
ac2aaf5770
4 changed files with 15 additions and 8 deletions
  1. +3
    -1
      modules/modelarts/resty.go
  2. +2
    -1
      routers/repo/download.go
  3. +8
    -4
      routers/repo/modelarts.go
  4. +2
    -2
      routers/repo/repo_statistic.go

+ 3
- 1
modules/modelarts/resty.go View File

@@ -30,9 +30,11 @@ const (
errorCodeExceedLimit = "ModelArts.0118"

//notebook 2.0
urlNotebook2 = "/notebooks"
urlNotebook2 = "/notebooks"

//error code
modelartsIllegalToken = "ModelArts.6401"
NotebookNotFound = "ModelArts.6404"
)

func getRestyClient() *resty.Client {


+ 2
- 1
routers/repo/download.go View File

@@ -28,7 +28,8 @@ func ServeData(ctx *context.Context, name string, reader io.Reader) error {
buf = buf[:n]
}

ctx.Resp.Header().Set("Cache-Control", "public,max-age=86400")
//ctx.Resp.Header().Set("Cache-Control", "public,max-age=86400")
ctx.Resp.Header().Set("Cache-Control", "max-age=0")
name = path.Base(name)

// Google Chrome dislike commas in filenames, so let's change it to a space


+ 8
- 4
routers/repo/modelarts.go View File

@@ -307,7 +307,7 @@ func NotebookDebug2(ctx *context.Context) {
ctx.RenderWithErr(err.Error(), tplModelArtsNotebookIndex, nil)
return
}
ctx.Redirect(result.Url)
}

@@ -387,7 +387,7 @@ func NotebookManage(ctx *context.Context) {
log.Error("ManageNotebook2(%s) failed:%v", task.JobName, err.Error(), ctx.Data["MsgID"])
resultCode = "-1"
errorMsg = err.Error()
if strings.Contains(err.Error(), "ModelArts.6404") {
if strings.Contains(err.Error(), modelarts.NotebookNotFound) {
errorMsg = "the job's version is too old and can not be restarted"
}
break
@@ -428,8 +428,12 @@ func NotebookDel(ctx *context.Context) {
_, err := modelarts.DelNotebook2(jobID)
if err != nil {
log.Error("DelNotebook2(%s) failed:%v", task.JobName, err.Error())
ctx.ServerError("DelNotebook2 failed", err)
return
if strings.Contains(err.Error(), modelarts.NotebookNotFound) {
log.Info("old notebook version")
} else {
ctx.ServerError("DelNotebook2 failed", err)
return
}
}

err = models.DeleteJob(task)


+ 2
- 2
routers/repo/repo_statistic.go View File

@@ -106,7 +106,7 @@ func RepoStatisticDaily(date string) {
repoStat := models.RepoStatistic{
RepoID: repo.ID,
Date: date,
Name: repo.Name,
Name: repo.Alias,
IsPrivate: repo.IsPrivate,
IsMirror: repo.IsMirror,
OwnerName: repo.OwnerName,
@@ -282,7 +282,7 @@ func RepoStatisticDaily(date string) {
}

func getDistinctProjectName(repo *models.Repository) string {
return repo.OwnerName + "/" + repo.Name
return repo.OwnerName + "/" + repo.Alias
}

func getDatasetSize(repo *models.Repository) (int64, error) {


Loading…
Cancel
Save