Browse Source

Merge pull request '增加云脑2数据集定时解压' (#688) from decompress-obs-manually into V20211101

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/688
Reviewed-by: zouap <zouap@pcl.ac.cn>
pull/709/head
zouap 3 years ago
parent
commit
ae9e10da08
2 changed files with 14 additions and 8 deletions
  1. +1
    -1
      models/attachment.go
  2. +13
    -7
      routers/repo/attachment.go

+ 1
- 1
models/attachment.go View File

@@ -379,7 +379,7 @@ func GetUnDecompressAttachments() ([]*Attachment, error) {

func getUnDecompressAttachments(e Engine) ([]*Attachment, error) {
attachments := make([]*Attachment, 0, 10)
return attachments, e.Where("decompress_state = ? and dataset_id != 0 and attachment.type = ? and (name like '%.zip' or name like '%.tar.gz' or name like '%.tgz')", DecompressStateInit, TypeCloudBrainOne).Find(&attachments)
return attachments, e.Where("decompress_state = ? and dataset_id != 0 and (name like '%.zip' or name like '%.tar.gz' or name like '%.tgz')", DecompressStateInit).Find(&attachments)
}

func GetAllPublicAttachments() ([]*AttachmentUsername, error) {


+ 13
- 7
routers/repo/attachment.go View File

@@ -917,16 +917,22 @@ func HandleUnDecompressAttachment() {
}

for _, attach := range attachs {
err = worker.SendDecompressTask(contexExt.Background(), attach.UUID, attach.Name)
if err != nil {
log.Error("SendDecompressTask(%s) failed:%s", attach.UUID, err.Error())
} else {
attach.DecompressState = models.DecompressStateIng
err = models.UpdateAttachment(attach)
if attach.Type == models.TypeCloudBrainOne {
err = worker.SendDecompressTask(contexExt.Background(), attach.UUID, attach.Name)
if err != nil {
log.Error("UpdateAttachment state(%s) failed:%s", attach.UUID, err.Error())
log.Error("SendDecompressTask(%s) failed:%s", attach.UUID, err.Error())
} else {
attach.DecompressState = models.DecompressStateIng
err = models.UpdateAttachment(attach)
if err != nil {
log.Error("UpdateAttachment state(%s) failed:%s", attach.UUID, err.Error())
}
}
} else if attach.Type == models.TypeCloudBrainTwo {
attachjson, _ := json.Marshal(attach)
labelmsg.SendDecompressAttachToLabelOBS(string(attachjson))
}

}

return


Loading…
Cancel
Save