Browse Source

Merge branch 'modelarts' of git.pcl.ac.cn:yoyoyard/opendata into modelarts

master
Gitea 4 years ago
parent
commit
8a586db25d
3 changed files with 4 additions and 3 deletions
  1. +2
    -0
      modules/storage/obs.go
  2. +1
    -1
      routers/repo/attachment.go
  3. +1
    -2
      routers/repo/modelarts.go

+ 2
- 0
modules/storage/obs.go View File

@@ -16,6 +16,7 @@ import (
)

//check if has the object
//todo:修改查询方式
func ObsHasObject(path string) (bool, error) {
hasObject := false
output, err := ObsCli.ListObjects(&obs.ListObjectsInput{Bucket:setting.Bucket})
@@ -25,6 +26,7 @@ func ObsHasObject(path string) (bool, error) {
}

for _, obj := range output.Contents {
//obj.Key:attachment/0/1/019fd24e-4ef7-41cc-9f85-4a7b8504d958
if path == obj.Key {
hasObject = true
break


+ 1
- 1
routers/repo/attachment.go View File

@@ -292,7 +292,7 @@ func AddAttachment(ctx *context.Context) {
return
}
} else {
has, err = storage.ObsHasObject(models.AttachmentRelativePath(uuid))
has, err = storage.ObsHasObject(setting.BasePath + models.AttachmentRelativePath(uuid))
if err != nil {
ctx.ServerError("ObsHasObject", err)
return


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

@@ -49,9 +49,8 @@ func ModelArtsIndex(ctx *context.Context) {
return
}

timestamp := time.Now().Unix()
for i, task := range ciTasks {
if task.Status == string(models.JobRunning) && (timestamp-int64(task.CreatedUnix) > 30) {
if task.Status == string(models.JobRunning) {
ciTasks[i].CanDebug = true
} else {
ciTasks[i].CanDebug = false


Loading…
Cancel
Save